Linux構成SSHはpubKeyでログインしrootパスワードのログインを無効にする

562 ワード

#   SSH    
vim /etc/ssh/sshd_config
#   root  ,    root    
PermitRootLogin prohibit-password

#   RSA  
RSAAuthentication yes

#   pubKey(id_rsa.pub)  
PubkeyAuthentication yes

# key        
AuthorizedKeysFile      .ssh/authorized_keys

もちろん、ファイルの権限にも注意してください.
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys 

そして、個人のSSH Keyを加入する.ssh/authorized_keysファイルにあります.このファイルは、一般に、現在のユーザのホームディレクトリ、すなわち~/.ssh/authorized_keys.
#   SSH  
service sshd restart