putty使用密钥登录debian7.5

原先总是通过用户口令和密码拥putty登录debian,今天尝试着使用密钥登录。

首先下载PuTTYgen,生成密钥,点击“Save private key”保留私钥,Key passphrase如果没有输入,则会提示,如果输入,可以保证私钥安全,但是登录ssh的时候会要求输入密码。

登录debian系统

# mkdir ~/.ssh
# chmod 700 ~/.ssh
# vim ~/.ssh/authorized_keys

将公钥复制粘贴进入保存
# chmod 644 ~/.ssh/authorized_keys

在debian7.5下面,只需sshd_config下的PasswordAuthentication yes修改为no避免用户使用口令登录就可以,没有网上说的其他选项。

重启shh。

返回putty,Connection-SSH-Auth,点Browse…,选择刚才保存的私钥,再进入Connection-Data,Auto-login username输入刚才保存公钥的登录用户名,切换到Session,Host Name调用或者新建,就可以使用密钥登录debian了。

 

 

 

参考: 配置Linux服务器SSH远程密钥登录 | 系统运维

Leave a Reply

您的电子邮箱地址不会被公开。 必填项已用 * 标注

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>