# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): <-- 直接输入回车 Enter same passphrase again: <-- 直接输入回车 Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: 49:9c:8a:8f:bc:19:5e:8c:c0:10:d3:15:60:a3:32:1c root@Server
# scp -p /root/.ssh/id_rsa.pub root@121.40.125.251:/root/.ssh/ root@192.168.0.20‘s password: <-- 输入机器Client的root用户密码 id_rsa.pub 100% |**************************| 218 00:00
# mv /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys <-- 或者 cat id_rsa.pub >authorized_keys
# scp -i /root/ .ssh/id_rsa text root@192.168.0.20:/root text 100% |**************************| 19 00:00
原文:http://www.cnblogs.com/jing99/p/7770639.html