1 在服务器上生成密钥 # ssh-keygen
2 创建目录 # tounch authorized_keys
3 给权限 # chmod 600 authorized_keys
4 修改/etc/ssh/sshd_config
#禁用密码验证PasswordAuthentication no#启用密钥验证RSAAuthentication yesPubkeyAuthentication yes
5 重启ssh服务
service sshd restart #centos系统