您的位置:首页 > 运维架构 > Linux

SecureCRT使用PublicKey认证连接linux

2011-11-12 17:39 253 查看
环境:
Server: CentOS-5.5 openssh-4.3p2-41.el5
Client: winxp sp3 SecureCRT 6.6

Client配置

SecureCRT窗口->;Tools->;create public key...;或者Options->;Global options->;SSH2;点击"Create Identity File"
根据屏幕指示,创建你的key file.
选择密钥类型时,选择 RSA 方式,然后还会让你输入一个保护本地privatekey file的密码.生成key后,为生成的密钥选择一个文件名和存放的路径(可以自行修改或使用默认值).这个时候在指定目录会生成两个文件,例如私钥Identity和公钥Identity.pub

Server配置 

    把之前生成的后缀名为.pub的密钥文件传到 linux 服务器,将SSH2兼容格式的公钥转换成Openssh的兼容格式

# ssh-keygen -i -f Identity.pub >> /root/.ssh/authorized_keys

如果没有.ssh目录,先新建个
# mkdir /root/.ssh
# chmod 700 /root/.ssh
检查sshd服务的Pubkey认证功能是否默认打开
/etc/ssh/sshd_config:
PubkeyAuthentication yes /*开启pubkey认证
RSAAuthentication yes /*启用 RSA 认证
PasswordAuthentication no /*如果要禁止密码验证登录,这项就改为no
然后重启sshd服务
#service sshd restart或者/etc/init.d/sshd restart

在SecureCRT里面设置登录模式的身份验证为PublicKey,并选择刚刚创建Identity文件作为私钥,正常情况下将提示要输入密钥的密码短语,就是那个保护本地privatekey file的密码,输入后就应该可以登陆进系统了.
 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息