SSH 免密登录

A 免密登录 B

1. 确保 B 安装 openssh-server
    查看 ps -e | grep ssh 是否有 sshd,安装之后还没有需要启动 ssh server:/etc/init.d/ssh start
2. 在 A 上生成密钥:ssh-keygen -t rsa
3. 将公钥复制到 B 上:ssh-copy-id userb@<IP_B>
    usera 的公钥文件内容会追加写入到 userb 的 .ssh/authorized_keys 文件中
4. 确保 B 的 .ssh目录的权限为700,其下文件 authorized_keys 的权限为 600
5. 在 A 上登录 B

原文地址:https://www.cnblogs.com/ainsliaea/p/11460820.html