[浩瀚银河]Linux ssh设置无密码登录+密钥登陆


设置privkey登录

chmod 600 ~/privkey.pem 
ssh -p 22 root@127.0.0.1 -i ~/privkey.pem 
ssh-keygen -p -f ~/privkey.pem 
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config && sed -i 's/#PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config && sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config && service sshd restart 

无密码SSH登录

vim /etc/ssh/sshd_config
编辑 PasswordAuthentication yes

全自动

#!/bin/bash
cd /root/.ssh
ls
cat authorized_keys 
wget (这一段为下载他人id_rsa文件的地址哦~)
ls
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
cat authorized_keys 
chmod 600 /root/.ssh/authorized_keys
ll

声明:浩瀚银河Typecho Powered-By-Lin.孟|版权所有,违者必究|如未注明,均为原创|本网站采用BY-NC-SA 4.0协议进行授权

转载:转载请注明原文链接 - [浩瀚银河]Linux ssh设置无密码登录+密钥登陆


因为数据备份问题,接下来typecho平台就做给大家的留念地方了。hexo重新开始!https://hexo.haohanyh.com