原文:https://blog.hwg1998.com/blog/92
之前一直是使用putty登录linux服务器,今天偶然发现,cmd就能直接ssh连上,只是每次都需要输入密码。于是找了一下怎样免密登录,特此记录一下。
- window 生成密钥
cmd下面运行一下命令
ssh keygen #然后一路回车就ok
会在当前用户的文件夹下的 .ssh目录下生成俩个文件 id_rsa 和 id_rsa.pub
- centos 配置
- 修改配置文件
vim /etc/ssh/sshd_config
- 将
PubkeyAuthentication yes 、 AuthorizedKeysFile .ssh/authorized_keys 、设置成生效状态 - 将window生成的
~/.ssh/id_rsa.pub内容复制到 centos上的~/.ssh/authorized_keys中 - centos重启一下ssh服务
systemctl restart sshd.serviceorservice sshd restart
- 自由的味道!
cmd 中可以免密登录服务器啦
ssh -i ~/.ssh/id_rsa root@ip
懒得上图了,不懂百度
本文介绍了如何在Windows上使用cmd通过SSH实现对CentOS服务器的免密登录。首先在Windows中生成SSH密钥,然后在CentOS上配置`sshd_config`文件,启用公钥认证并将Windows的公钥内容添加到`authorized_keys`文件中,最后重启SSH服务即可实现免密连接。
1268

被折叠的 条评论
为什么被折叠?



