ssh-keygen -t rsa
ssh-copy-id terry@192.168.120.128
修改ssh配置文件
[root@localhost ~]# vim /etc/ssh/sshd_config
RSAAuthentication yes #使用密钥验证
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys #验证文件的名称
----------------------------可选配置--------------------------------------
Protocol 2 #修改后变为此状态,仅使用SSH
ServerKeyBits 1024 #修改后变为此状态,将ServerKeyBits改为1024比特
PermitRootLogin no #不允许用Root进行登录
PasswordAuthentication no #不允许密码方式的登录
PermitEmptyPasswords no #禁止空密码进行登录
另一台机器也这么做即可