-- 创造无限可能

ssh:开启远程登录、禁止密码登录

2022-10-30 14:54:09
675 人浏览 8 人点赞
有用,点赞支持一下
  • 复制公钥到被管理机器
    ssh-copy-id -i ~/.ssh/id_rsa.pub 172.29.0.*
    
  • 禁用密码登陆
    PasswordAuthentication no  //修改为no
    
  • 启用密钥验证
    RSAAuthentication yes
    PubkeyAuthentication yes
    
  • 指定公钥数据库文件(默认、一般无需修改)
    AuthorizedKeysFile  .ssh/authorized_keys
    
  • 重启服务
    service sshd restart