ssh访问的前提是两台服务器的SSH服务端口都打开,

client:ssh-keygen 生成公钥id_rsa.pub 私钥id_rsa

公钥是给目标服务器去解析的,私钥是自己保留的,当前默认的ssh目录是/root/.ssh/

通过scp将公钥传给目标服务器。并改名为authorized

scp /root/.ssh/id_rsa.pub 192.168.7.46:/root/.ssh/authorized_keys

ssh 192.168.7.46.。OK