- 论坛徽章:
- 0
|
一、SecureCRT:
配置SecureCRT上的RSA密钥,打开SecureCRT→Quick Connect→Authentiation→PublicKey→Properties→Create Identity File,Key选择RSA;Passphrase可以不同于密码,任意的字符串即可;Key length in为加密长度,可为512到2048位,要是在linux上可配置4096;
下一步为生成过程,需要不停在进度条附近晃动鼠标,选择在x:\%USERPROFILE%\Application Data\VanDyke下生成两个文件,并且格式为Openssh Key format,要是选默认的Standard Public Key and VanDyke Private Key可能还需要格式转换或有兼容问题,公钥Identity.pub和私钥Identity。
二、去到SecureCRT 生成密钥的保存目录下,把公钥Identity.pub 上传到服务器root用户底下的隐藏目录.ssh下。
mkdir /home/test/.ssh
chmod o+x /home/test
chmod 755 /home/test/.ssh
cd /home/test/.ssh
ssh-keygen -X -f Identity.pub >> /home/test/.ssh/authorized_keys
chmod 644 /home/test/.ssh/authorized_keys
三、修改ssh配置
#vi /etc/ssh/sshd_config
PasswordAuthentication no #不使用口令认证
PubkeyAuthentication yes #使用非对称密钥认证
AuthorizedKeysFile .ssh/authorized_keys #用户认证使用的公钥。
ChallengeResponseAuthentication no #这样没有私钥的人就会被服务器拒绝登陆
四、要实现openssh只支持RSA验证方式,我们只要修改 (修改这之后,ssh不能直接连了)
vi /etc/ssh/sshd_config
设置
PasswordAuthentication no
五、重启ssh即可,注意保存密钥文件
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/98137/showart_2071097.html |
|