SSH无密码确认配置

来源:互联网 发布:上瘾网络剧第二季资源 编辑:程序博客网 时间:2024/04/30 12:52

今天配置hadoop过程中发现,ssh localhost 配置RSA认证(要求无密码),不然要输入三次密码启动服务。

但是郁闷的是我执行了下面的命令却无效

Java代码 复制代码 收藏代码
  1. $ ssh-keygen -t rsa 
  2. Generating public/private rsa key pair. 
  3. Enter file in which to save the key (/home/youruser/.ssh/id_rsa): 
  4. Enter passphrase (empty for no passphrase): 
  5. Enter same passphrase again: 
  6. Your identification has been saved in /home/youruser/.ssh/id_rsa. 
  7. Your public key has been saved in /home/youruser/.ssh/id_rsa.pub. 
  8. The key fingerprint is: 
  9. 11:11:35:75:40:c5:nh:2d:7u:96:c3:rr:81:86:67:53 youruser@yourhost 

然后我ssh localhost 却要求输入密码

没办法,我找另外个机器 配置ssh认证,记得以前是配置过的,怎么会失效呢?结果也没成功,最后无奈之下:删除了机器上所有的认证文件:

Java代码 复制代码 收藏代码
  1. rm ~/.ssh/* 

重新配置,就好了,哎,又是一次教训,上次配置时候没有做笔记,这次就记下。

当然重新温习了一下:RSA/DSA认证,还是有好处的,记忆中模糊了。

下面有三篇好文章,记得看一下哦,人家讲解的通俗易懂,考虑的又比较全面:

http://www.ibm.com/developerworks/cn/linux/security/openssh/part1/index.html

http://www.ibm.com/developerworks/cn/linux/security/openssh/part2/index.html

http://www.ibm.com/developerworks/cn/linux/security/openssh/part3/index.html

再一个就是网上有些资料,有误导作用,千万小心了,举例:

修改 /etc/ssh/sshd_conf 文件

PasswordAuthentication yes->no

如果你的服务器不在本地,千万不能这样做,万一当前的ssh链接中断,那你得麻烦机房的人给你修改配置了。小心起见,我在本地机器上试验了,RAS认证没弄好,密码验证又禁止了,你哭吧。呵呵

原创粉丝点击