1.$ vi /etc/ssh/sshd_config
找到以下内容,并去掉注释符”#“
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
2.service sshd restart
3.生成证书公私钥的步骤:
$ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
4.$ chmod 600 ~/.ssh/authorized_keys
$ chmod 700 ~/.ssh
5.测试登陆 ssh localhost:
$ ssh localhost
6.scp ~/.ssh/id_dsa.pub ql@192.168.1.111:/home/ql/7.登陆远程主机
$ cat id_dsa.pub >> ~/.ssh/authorized_keys
8.$chmod 600 ~/.ssh/authorized_keys
$chmod 700 ~/.ssh
9.测试
ssh ql@192.168.1.111
参考