1、SecureCRT设置
==========================================
Quick Connect-> Authentiation -> Public Key -> Properties ->Create Identity File ->
DSA/RSA -> Set Passphrase -> Done
完成时会在指定目录生成两个文件,默认名称为:私钥Identity和公钥Identity.pub。
2、SSH服务器设置
如果不存在/root/.ssh目录,则自行建立。
# mkdir /root/.ssh
# chmod 700 /root/.ssh
将公钥Identity.pub传到Linux服务器,将SSH2兼容格式的公钥转换成为Openssh兼容格式。
# ssh-keygen -i -f Identity.pub >> /root/.ssh/authorized_keys
# chmod 600 /root/.ssh/authorized_keys
3、使用SecureCRT登录服务器
首先设置登录模式为PublicKey,并选择刚刚创建的公钥文件Identity.pub。
4、重启Linux服务器的ssh服务
# service sshd restart
5、设置ssh配置文件
为了安全建议只使用密钥登录,去掉默认的密码登录。
# vi /etc/ssh/sshd_config
Protocol 2 //仅允许使用SSH2
PubkeyAuthentication yes //启用PublicKey认证
AuthorizedKeysFile .ssh/authorized_keys //PublicKey文件路径
PasswordAuthentication no //禁止密码验证登录
使用Linux服务器端生成类型为DSA、长度1024bits的公钥文件
ssh-keygen -t dsa -b 1024
//询问passphrase的时候直接回车