RedHat5.5-SSH免密登录

3台机器:192.168.197.130,131,132,从130免密登录130,131,132

1、在130机器一用户(hadoop)执行:

ssh-keygen-tdsa-P''-f~/.ssh/id_dsa

2、进去到.ssh目录,把此次公钥追加到authorized_keys文件中

catid_dsa.pub>>authorized_keys

3、把id_dsa.pub传送到131,132的.ssh目录下(如果目录不存在,就创建一个,并确保权限为700,重要)

4、在131,132的.ssh目录下:

catid_dsa.pub>>authorized_keys

确保authorized_keys全新为600(重要)

5、最后再130上测试:

ssh192.168.197.130

ssh192.168.197.131

ssh192.168.197.132

如果有问题,可以查看131,132的/var/log/secure日志

此后有有一新用户(hbase),同样要免密登录130,131,132:

方法一:重复以上2,3,4,5步骤即可(即复用上次hadoop生产的一对公私钥)

方法二:

1、hbase重新生成一堆公私钥:

ssh-keygen-tdsa-P''-f~/.ssh/hbase_dsa

2、进去到.ssh目录,把此次公钥追加到authorized_keys文件中

catid_dsa.pub>>authorized_keys

3、.ssh目录下创建config文件(确保全新为600),然后写入:

Hosthadoop130

HostName192.168.197.130

Userhadoop

IdentityFile~/.ssh/id_dsa

Hosthbase130

Hostname192.168.197.130

Userhbase

IdentityFile~/.ssh/hbase_dsa

Hosthadoop131

HostName192.168.197.131

Userhadoop

IdentityFile~/.ssh/id_dsa

Hosthbase131

Hostname192.168.197.131

Userhbase

IdentityFile~/.ssh/hbase_dsa

Hosthadoop132

HostName192.168.197.132

Userhadoop

IdentityFile~/.ssh/id_dsa

Hosthbase132

Hostname192.168.197.132

Userhbase

IdentityFile~/.ssh/hbase_dsa

4、最后再130上测试:

sshhbase130

sshhbase131

sshhbase132

sshhadoop130

sshhadoop131

sshhadoop132

ssh

相关推荐