建立密钥对
# 密钥锁码可输入指定密码,如果不输入就直接回车ssh-keygen
在服务器上安装公钥
cd ~/.ssh/cat id_rsa.pub >> ~/.ssh/authorized_keyschmod 600 authorized_keyschmod 700 ~/.ssh
SSH服务设置
# 编辑SSH配置文件sudo vim /etc/ssh/sshd_config# 密钥验证支持RSAAuthentication yesPubkeyAuthentication yes# Root用户是否能通过SSH登录PermitRootLogin no# 关闭密码验证通道PasswordAuthentication no# 关闭DNSUseDNS no
重启SSH服务
service sshd restart
