首页 > 代码库 > ssh无密码登陆

ssh无密码登陆

生成密钥并复制

ssh-keygen -t rsa -P ‘‘
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys

修改SSH配置文件

更改/etc/ssh/sshd_config中的

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile  .ssh/authorized_keys

将KEY拷贝到DATANODE机器并复制

scp ~/.ssh/id_rsa.pub xxx@192.168.2.110:~/.ssh/
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
再以和NAMENODE机器中的同样的方式修改DATANODE机器中的SSHD_CONFIG