linux ssh密鑰登錄
阿新 • • 發佈:2017-07-11
linux ssh密鑰登錄
ssh 端口:tcp 22
建議創建普遍用戶登錄管理
創建用戶
useradd user
設置密碼
passwd user
創建密鑰
ssh-keygen -t rsa -P ‘‘
創建公鑰
cat ~/.ssh/id_rsa.pub >~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
私鑰
id_rsa
ssh配置文件
vi /etc/ssh/sshd_conf
--------------------------------
PermitRootLogin no // 改為no 禁止root用戶登錄
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication no // 改為 no 禁止口令登錄
--------------------------------
去掉#
service sshd restart
本地服務器上將authorized_keys復制到遠程服務器上
scp ~/.ssh/authorized_keys 10.10.10.10:/home/user/.ssh/
本文出自 “Shell” 博客,請務必保留此出處http://zhizhimao.blog.51cto.com/3379994/1946301
linux ssh密鑰登錄