仍提示输入密码,5配置SSH免密码登录

  1. 在node0的/home/cluster/.ssh目录下执行如下命令:

scp ~/.ssh/authorized_keys xxx@主机名:/home/xxx/.ssh/

开启SSH服务让Android手机远程访问
Ubuntu 14.04 
http://www.linuxidc.com/Linux/2014-09/106809.htm

  1. 检查node0和node1是否可以无需密码而直接互相登录:

Oct  7 10:26:43 MasterServer
sshd[2734]: Authentication refused: bad ownership or modes for file
/home/Hadooper/.ssh/authorized_keys
Oct  7 10:26:48 MasterServer sshd[2734]: Accepted password for
hadooper from ::1 port 37456 ssh2
Oct  7 10:26:48 MasterServer sshd[2734]: pam_unix(sshd:session):
session opened for user hadooper by (uid=0)
Oct  7 10:36:30 MasterServer sshd[2809]: Accepted password for
hadooper from 192.168.1.241 port 36257 ssh2
Oct  7 10:36:30 MasterServer sshd[2809]: pam_unix(sshd:session):
session opened for user hadooper by (uid=0)
Oct  7 10:38:28 MasterServer sshd[2857]: Authentication refused: bad
ownership or modes for directory /home/hadooper/.ssh

更多CentOS相关信息见CentOS 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=14

CentOS 下SSH无密码登录的配置
http://www.linuxidc.com/Linux/2012-05/61346.htm

首先将认证文件复制到服务器

如果遇到登录失败的情况:我用的是centos版本是6.5,centos6.5对网络管理相当严格,需要在原来的基础上关闭selinux,
到/etc/selinux/config下,把SELINUX=enforcing修改为SELINUX=disabled,重启机器,ok。

两台主机均为CentOS系统,主机名分别为node0和node1,node0的IP为10.141.4.36,node1的IP为10.141.4.39,两台主机均使用用户名cluster。
 

CentOS配置SSH无密码登录需要3步:

提高Ubuntu的SSH登陆认证速度的办法
http://www.linuxidc.com/Linux/2014-09/106810.htm

scp node0:/home/cluster/.ssh/id_rsa.pub /home/cluster/.ssh/tmp
cat tmp >> authorized_keys
rm tmp

cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys 

设置.ssh目录权限 chmod 700 -R .ssh
如果你想要每台机子都无密码登录,那么把每台机子产生的密钥添加到文件中(这是在受控端机子上面执行的)
cat id_rsa.pub >> .ssh/authorized_keys
 

scp node1:/home/cluster/.ssh/id_rsa.pub /home/cluster/.ssh/tmp
cat tmp >> authorized_keys
rm tmp

默认在 ~/.ssh目录生成两个文件:
    id_rsa      :私钥
    id_rsa.pub  :公钥

SSH入门学习基础教程
http://www.linuxidc.com/Linux/2014-06/103008.htm

发表评论

电子邮件地址不会被公开。 必填项已用*标注