centOS KEY免密码登录

ssh-keygen -t rsa
按回车直到生成秘钥为止

/root/.ssh/下会生成id_rsa和id_rsa.pub
将id_rsa.pub改名为:authorized_keys

id_rsa即为用户客户端登陆秘钥
以后生成的id_rsa.pub追加到authorized_keys中
cat id_rsa.pub>>authorized_keys
删除id_rsa.pub

禁止SSH密码登陆
修改/etc/ssh/sshd_config最后一行:PasswordAuthentication no

你可能感兴趣的:(centOS KEY免密码登录)