[Linux]密钥登录

  1. 生成rsa密钥
1
ssh-keygen -t rsa
  1. 修改/etc/ssh/sshd_config文件

    1. 取消注释,允许密钥登录
1
2
3
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
2. 不允许密码登录,只允许密钥登录
1
PasswordAuthentication no
  1. 重启ssh
1
/etc/init.d/sshd restart

(•̀ᴗ•́)و ̑̑

Share