免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 933 | 回复: 0
打印 上一主题 下一主题

ssh通过密钥来访问,提高服务器安全 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-10-15 16:59 |只看该作者 |倒序浏览
一、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
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP