sshd连接注意:
1.默认启用公钥认证及密码认证(Secure Shell Client登录不了,用SecureCRT 5.0没问题)
2.不允许root登录(必须先建立一个用户,而且是wheel组的,登录后再su到root)
在线更改SSHD默认端口:
vi /etc/ssh/sshd_config
/etc/rc.d/sshd restart
使用SSH PUBLIC KEY:
方法1(由FreeBSD生成密钥对):
1.在FreeBSD中执行:
ssh-keygen -t dsa
可得到
/home/xxx/.ssh/id_dsa
/home/xxx/.ssh/id_dsa.pub
2.下载这个两个文件到本地,并在SecureCRT设置登录方式中选择PublicKey的Properites -> Use session public key setting -> Use identify file ->选择id_dsa (两个文件要放在一起,文件名任意,但必须符合somekey和somekey.pub)
3.改成/etc/ssh/ssh_config中指定的公钥文件名,在FreeBSD中执行:
mv /home/xxx/.ssh/id_dsa.pub /home/xxx/.ssh/authorized_keys
方法2(由SecureCRT生成密钥对):
1.设置好用户名后,在SecureCRT设置登录方式中选择PublicKey的Properites -> Use session public key setting -> Use identify file ->Create Identify File->DSA->生成 Identity 与Identity.pub
2.把Identity.pub上传到FreeBSD的/home/xxx/.ssh
3.在FreeBSD中执行:
ssh-keygen -X -f Identity.pub > authorized_keys
取消sshd密码认证方式:
vi /etc/ssh/sshd_config
PasswordAuthentication no
/etc/rc.d/sshd restart