首页 > 其他 > 详细

SSH免密配置

时间:2020-01-18 18:53:47      阅读:103      评论:0      收藏:0      [点我收藏+]

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

2.合并三个节点的密码
cat id_rsa.pub >> authorized_keys
ssh postgres@test-postgre-sql-2 cat ~/.ssh/id_rsa.pub>> authorized_keys
ssh postgres@test-postgre-sql-3 cat ~/.ssh/id_rsa.pub>> authorized_keys

3 分发authorized_keys和known_hosts到三个节点
scp authorized_keys postgres@test-postgre-sql-2:/home/postgres/.ssh/.
scp known_hosts postgres@test-postgre-sql-2:/home/postgres/.ssh/.

scp authorized_keys postgres@test-postgre-sql-3:/home/postgres/.ssh/.
scp known_hosts postgres@test-postgre-sql-3:/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

SSH免密配置

原文:https://www.cnblogs.com/lyonlee/p/12209826.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!