Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1947601
  • 博文数量: 424
  • 博客积分: 1291
  • 博客等级: 中尉
  • 技术积分: 2682
  • 用 户 组: 普通用户
  • 注册时间: 2012-08-13 01:34
个人简介

linux oracle 网络安全 编程

文章分类

全部博文(424)

文章存档

2016年(22)

2015年(53)

2014年(57)

2013年(242)

2012年(50)

分类: LINUX

2013-03-17 16:21:04

出于安全的需要把所以线上服务器弄成密钥登录,而且使用使用密码短语加密(其实没有人这么干),好吧,我承认这样子是有点麻烦,但是安全第一。

以下为设置步骤

1,生成密钥的公钥和私钥


[plain]
  1. [root@puppet_client .ssh]# ssh-keygen -t rsa 
  2. Generating public/private rsa key pair. 
  3. Enter file in which to save the key (/root/.ssh/id_rsa):  
  4. Enter passphrase (empty for no passphrase):  # 生成密码短语  
  5. Enter same passphrase again:                 #重复密码短语  
  6. Your identification has been saved in /root/.ssh/id_rsa. 
  7. Your public key has been saved in /root/.ssh/id_rsa.pub. 
  8. The key fingerprint is: 
  9. 36:51:f0:41:60:5f:45:0b:a5:95:9b:78:c6:09:e4:b6 root@puppet_client.luckcart.com 


2,通过其他工具把上述生成的私钥下载到本地的windows机器上,并且把公钥导入到.ssh/authorized_keys 文件中去



[html]
  1. cat id_rsa.pub > authorized_keys 



3,设置sshd  服务器服务
打开以下设置:



[html]
  1. RSAAuthentication yes 
  2. PubkeyAuthentication yes 
  3. AuthorizedKeysFile      .ssh/authorized_keys 
  4.  
  5. 修改以下设置: 
  6. ChallengeResponseAuthentication no 
  7. PasswordAuthentication no 
  8. UsePAM no 


此时需要重启sshd
[html]
  1. service sshd restart 



4,导入私钥到远程工具中,实验采用xshell。


3,此时输入刚才设置的密码短语,如果在生成密钥的时候没有输入密码短语,此时可以不用输入。

5.经过以上步骤,即可完成私钥登录了。

阅读(3508) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~