使用windows的ssh的public key来连接 linux

1.在SSH Secure Shell Client生成key
settings->User Authentication->keys->Generate New...->下一步->RSA->下一步->File:authorized_keys->下一步完成


2.把C:\Documents and Settings\Administrator\Application Data\SSH\UserKeys下的authorized_keys.pub上传到服务器的/root目录上去
[root@mysqlserver ~]# mkdir .ssh
[root@mysqlserver ~]# cd .ssh
[root@mysqlserver .ssh]# ssh-keygen -i -f ../authorized_keys.pub >> authorized_keys
[root@mysqlserver .ssh]# cd /etc/ssh/
[root@mysqlserver ssh]# cp sshd_config sshd_config.back
[root@mysqlserver ssh]# vi sshd_config
PubkeyAuthentication yes /*启用PublicKey认证
AuthorizedKeysFile .ssh/authorized_keys /*PublicKey文件路径


PasswordAuthentication no /*禁止密码验证登录


[root@mysqlserver ssh]# /etc/rc.d/init.d/sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                               [  OK  ]

3.在windows上使用SSH Secure Shell Client登录linux主机选择public key方式就可以登录了

猜你喜欢

转载自wuhuizhong.iteye.com/blog/780580