去putty官网下载putty并且安装,PuTTY下载地址http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html 在程序里找到putty的文件夹,调开puTTYgen,点一下Generate生成公钥,当他生成的时候,鼠标要不停的动不然进度条会很慢,方框内的ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEA/OiiseaTojSIGXS86+atfKSLj2eb/ddC94gAaX6G4+kcsb2LogjFSxKmvt0HmQfyQWxJk+ONClKziQ2JHioPco8fWVWLrzsScMuxb+s+Rh5mjy06/3o6pXEFOaT/Xkaq2qMCo98zyKPFOwwTlxM4ojhSMDcOp8mBhkBl0fJXLssqUU/O85yhUVPABiAhnsRhxSpnOzjMtbeCZJBSN3XUIDgKyngeRb307C28TPSKaZYzOSKbL1fbt52/vfNT9DFYBKUkFalVFeJYsvNcPy6bve/anjE+FJB+pgIEUOjy1fbVCS7g6aIJgTlmr4cvX4v9Z8/c9hMc6ShCNyG6MkOFZQ== rsa-key-20150827是公钥,放在服务端。给私钥Key passphrase设置密码,然后点击Save private key保存私钥。拷贝公钥去Linux服务端,[root@slave ~]# mkdir /root/.ssh
[root@slave ~]# ls -a /root/(查看.ssh目录)
[root@slave ~]# vi /root/.ssh/authorized_keys,把公钥复制进来。
[root@slave ~]# chmod 700 /root/.ssh/
[root@slave ~]# chmod 600 /root/.ssh/authorized_keys
关闭防火墙service iptables stop;setenforce 0