环境:
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的密码,输入后就应该可以登陆进系统 了.
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的密码,输入后就应该可以登陆进系统 了.
转载于:https://blog.51cto.com/yuewe/712643