2 machines
1. 192.168.1.112
2. Man-Machine 192.168.1.110
To enable 110, you do not need a password to log on to 112 through SSH.
Procedure
1. Create a key
Miao @ u32-192-168-1-110 :~ /. SSH $ ssh-keygen-T rsagenerating public/private RSA key pair. enter passphrase (empty for no passphrase): (ignore) Enter same passphrase again: (ignore) Your identification has been saved in/home/Miao /. SSH/id_rsa.your public key has been saved in/home/Miao /. SSH/id_rsa.pub.
2. Copy the public key to the server
miao@u32-192-168-1-110:~/.ssh$ scp id_rsa.pub miao@192.168.1.112:/home/miao/.ssh/192.168.1.110miao@192.168.1.112's password: id_rsa.pub 100% 404 0.4KB/s 00:00 miao@u32-192-168-1-110:~/.ssh$
3. Add the public key to the trusted area of 192.168.112.
miao@debian-192-168-1-112:~/.ssh$ cat 192.168.1.110 >> authorized_keysmiao@debian-192-168-1-112:~/.ssh$
Note: steps 2 and 3 can be completed by command ssh-copy-ID in one step
miao@ubuntu-192-168-1-110:~/.ssh$ ssh-copy-id miao@192.168.1.112Password:Now try logging into the machine, with "ssh 'miao@192.168.1.112'", and check in: .ssh/authorized_keysto make sure we haven't added extra keys that you weren't expecting.
4. Start ssh-agent
If SSH 192.168.112 is returned, the agent admitted failure to sign using the key
PS-AF | grep agent: Check whether the ssh-agent is running. If no
miao@u32-192-168-1-110:~/.ssh$ ssh-agent
5. Add id_rsa to the SSH-agent
miao@u32-192-168-1-110:~/.ssh$ ssh-add id_rsa
6. Complete
Author: http://www.jiangmiao.org/blog/559.html