SSH免密配置

mmyCSDN 2020-01-18

1. 在三个节点生成秘钥
cd ~/.ssh
ssh-keygen -t rsa

2.合并三个节点的密码
cat id_rsa.pub >> authorized_keys
ssh cat ~/.ssh/id_rsa.pub>> authorized_keys
ssh cat ~/.ssh/id_rsa.pub>> authorized_keys

3 分发authorized_keys和known_hosts到三个节点
scp authorized_keys :/home/postgres/.ssh/.
scp known_hosts :/home/postgres/.ssh/.

scp authorized_keys :/home/postgres/.ssh/.
scp known_hosts :/home/postgres/.ssh/.

4. 设置权限
chmod 700 ~/.ssh/
chmod 600 authorized_keys

5.SSH登录过程如果出现问题可查看安全日志
/var/log/secure

常见问题
Jan 18 18:12:00 test-postgre-sql-2 sshd[12378]: Authentication refused: bad ownership or modes for file /home/postgres/.ssh/authorized_keys

相关推荐