SecureCRT使用密钥登录SSH服务器

1.使用SecureCRT创建私钥和公钥.
SecureCRT: Quick Connect -> Authentiation -> Public Key -> Properties -> Create Identity File -> DSA/RSA -> Set Passphrase -> Done
这个时候在指定目录会生成两个文件,例如,私钥my_rsa和公钥my_rsa.pub
2.linux服务器上建立.ssh目录,一般情况下,已经有这个目录
# mkdir /root/.ssh
# chmod 700 /root/.ssh
3.将公钥 my_rsa.pub 传到linux服务器,将SSH2兼容格式的公钥转换成为Openssh兼容格式
# ssh-keygen -i -f Identity.pub >> /root/.ssh/authorized_keys2
# chmod 600 /root/.ssh/authorized_keys2
4.在SecureCRT里面设置登录模式为PublicKey,并选择刚刚创建的my_rsa文件作为私钥
5.重启Linux服务器上SSH服务器
#service sshd restart 或者 /etc/rc.d/init.d/sshd restart
6.由于已经设置了密钥登录,原来的密码登录就完全可以去掉
# vi /etc/ssh/sshd_config
Protocol 2 /仅允许使用SSH2
PubkeyAuthentication yes /*启用PublicKey认证
AuthorizedKeysFile .ssh/authorized_keys2 /*PublicKey文件路径
PasswordAuthentication no /*禁止密码验证登录
PS:以上步骤是使用SecureCRT生成的密钥对来进行登录验证的,其实也可以在服务器上使用ssh-keygen命令生成的密钥,同样在生成密钥对之后,将格式转换成SecureCRT 使用的SSH2格式