ssh-keygen -t rsa
一直按enter
chmod 0700 /root/.ssh
chmod 0600 /root/.ssh/*
scp -P 22 /root/.ssh/id_rsa.pub root@1.2.3.4:.ssh/
输入密码
上传后
ssh -p 22 root@1.2.3.4
输入密码登陆
chmod 0700 /root/.ssh
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized.key
chmod 0600 /root/.ssh/authorized.key
exit
最后ssh -p 22 root@1.2.3.4 或者 ssh -p 22 root@1.2.3.4 -i /root/.ssh/id_rsa