码迷,mamicode.com
首页 > 其他好文 > 详细

SSH免密配置

时间:2020-01-18 19:43:14      阅读:96      评论:0      收藏:0      [点我收藏+]

标签:author   secure   配置   res   登录   file   合并   sql   log   

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免密配置

标签:author   secure   配置   res   登录   file   合并   sql   log   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!