【修改ssh认证文件路径】

/etc/ssh/sshd_config

修改AuthorizedKeysFile ./ssh/authoried_keys 为

AuthorizedKeysFile /etc/ssh/auth_key/%u/authoried_keys

 

重启sshd

/etc/init.d/sshd restart

或者

service sshd restart

 

 

【修改sftp认证文件路径】

/etc/ssh/sftpd_config

修改 AuthorizedKeysFile /home/sftp/%u/authoried_keys 为

AuthorizedKeysFile /etc/sftp/%u/authoried_keys

 

重启sftp

/etc/init.d/sftpd restart

或者

service sftpd restart

 

 

【建立ssh互信(免密码登录)】

在node1,node2,node3分别执行:

su - test

ssh-sshgen -t rsa

 

生成

$HOME/.ssh/id_rsa

$HOME/.ssh/id_rsa.pub

cp $HOME/.ssh/id_rsa.pub $HOME/.ssh/authorized_keys

 

说明:authorized_keys存储 目标节点的 id_rsa.pub的内容。所以 可以使的所有节点机器的 id_rsa,id_rsa.pub 都相同,则 认证文件 authorized_keys 即不需存储多个id_rsa.pub,只需写1个 id_rsa.pub

 

手动测试互信:

su - test

ssh test@node1

ssh test@node2

ssh test@node3

说明:首次测试互信需要输入密码,生成 $HOME/.ssh/known_hosts

 

相关文章:

  • 2022-12-23
  • 2022-01-09
  • 2021-04-01
  • 2022-01-20
  • 2021-07-04
  • 2021-06-13
  • 2022-01-15
  • 2021-12-30
猜你喜欢
  • 2021-05-17
  • 2021-05-26
  • 2022-12-23
  • 2021-11-18
  • 2021-08-03
  • 2022-02-01
  • 2022-12-23
相关资源
相似解决方案