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

OpenSSH 与 SecureCRT 公钥认证登陆

2011-11-17 13:46 232 查看
在Windows客户机的SecureCRT程序的Tools菜单中,调出"Create Publib Key"向导,依提示产生一密钥对。默认产生的密钥对会存放在 "C:\Documents and Settings\%USERNAME%\Application Data\VanDyke\",其中 Identity 就是私钥文件,Identity.pub 这是公钥文件。

2 在Linux服务器上编辑 sshd.config 文件

#vi /usr/local/etc/sshd_config

做如下修改:

PasswordAuthentication no (关闭口令认证)

PubkeyAuthentication yes (开启公钥认证)

AuthorizedKeysFile .ssh/authorized_keys (认证公钥文件位置)


3 依旧在Linux服务器上

#mkdir /root/.ssh (新建/root目录下的.ssh文件夹)

#chmod 700 /root/.ssh (修改.ssh文件夹的用户权限)


4 上传Windows客户机SecureCRT生成的公钥 Identity.pub,

OpenSSH公钥没有使用采用 IETF SECSH 标准,所以和SecureCRT的公钥格式不兼容,需要使用OpenSSH自带的 ssh-keygen 命令转换以后才能被OpenSSH识别。authorized_keys 可以保存多个公钥,所以公钥格式转换导入的时候,应该使用追加符 >> ,而不是 >。

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

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/30815/showart_411927.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: