个人博客地址,更多精彩内容
Xshell通过密钥登录服务器
ssh-keygen
[root@linux-node ~]# grep '^[A,P]' /etc/ssh/sshd_config
PubkeyAuthentication yes #启用PublicKey认证
AuthorizedKeysFile .ssh/authorized_keys #PublicKey文件路径
PasswordAuthentication no #不适用密码认证登录
- 3.进入云服务器的.ssh目录下,将生成的公钥拷贝到authorized_keys文件中,并赋予700权限
vim /etc/ssh/authorized_keys
chmod 700 /etc/ssh/authorized_keys
vim /etc/ssh/sshd_config
PubkeyAuthentication yes #启用PublicKey认证
AuthorizedKeysFile .ssh/authorized_keys #PublicKey文件路径
PasswordAuthentication no #不适用密码认证登录
systemctl restart sshd
ssh root@118.118.118.118
ssh命令
ssh-keygen
service sshd restart
ssh -V
Linux免密码登录设置(方法二)
- 第一步:ssh-keygen -t rsa(已存在,这步可省略)
- 第二步:ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.1.100
- 第三步:ssh root@118.118.118.118
- 无法连接的话,删除known_hosts中的主机信息
个人博客地址,更多精彩内容