1.本机(172.16.10.228)先生成密钥对
ssh-keygen -t rsa
2.执行命令,把本机公钥拷贝到远程机器
ssh-copy-id root@distinctIp
3.查看一下远程机器 、/root/.ssh/authorized_keys文件
cat /root/.ssh/authorized_keys
会看到里边多了个公钥
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3vnLLC8gyD/x5ZFtcN5bGG+ZtIm+qh2ttcyhRAz0GturixwVe+GBDL2DO5fgF7vv9w8x3DMycJWvFRvFV1AJYrD0A2RQfEWvqpNcJLEwUQIppyrSitSPKh9bwTSwfmKceuNHQ/zII8kg9yzABMyswezETTFOsY1Yuh/2wohlLVQD4LJe6kR8tT02vEPz/o+B80ZZ7vUVSjdKLbFKrdyLZmQUCNs15U00peMjDuSeDaQXYtcP5IExfNbQHPHtY3I86STok3iGcSoTB2jNikhYai0mKjaHjCSW4vMw/e5K0OrW00OuGAdSsq24xhQ0Pj3VPhXe10OcGtUV0sU+c4i6d root@172.16.10.228
最后从本机就可以访问远程机器了