机器A、B间ssh免密登录
机器A、B上分别执行:
ssh-keygen -t rsa
生成机器公钥(~/.ssh/id_rsa.pub)和私钥(~/id_rsa)。
- 将机器A、B上的公钥(~/.ssh/id_rsa.pub)均放于文件
~/.ssh/authorized_keys
中,并使机器A、B上均存在此文件。
注:文件~/.ssh/authorized_keys
需要自己创建,文件权限为600 - 重启sshd服务
systemctl restart sshd
- 使用 ssh 登录测试