假设A、B都是linux服务器,现在想在A上面通过ssh不需要输入密码访问B。操作步骤如下:

在A服务器上执行 ssh-keygen -t rsa #生成密钥

scp /root/.ssh/id_rsa.pub root@B的IP:/root/.ssh/authorized_keys  #将公共密钥复制到要访问的服务器机器上去