首页 > 代码库 > linux ssh密钥登录
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密钥登录
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。