1、生成密钥
[root@client .ssh]# 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:
71:41:75:8e:c8:5a:0c:c2:8a:62:1c:49:cd:1c:8a:0d root@client
[root@client .ssh]# ls
id_rsa  id_rsa.pub  known_hosts
 
 
2、更改权限
chmod 755 ./ssh
 
3、密钥上传远程机器
把id_rsa.pub 拷到要远程的机器上,命名为authorized_keys
[root@www .ssh]# scp root@192.168.3.192:/root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
id_rsa.pub           100% |*****************************|   221       00:00