現有2臺機器
html
一、服務器192.168.1.112
二、我的機192.168.1.110
要使110無需密碼經過ssh登入112服務器
步驟
一、建立密鑰ssh
miao@u32-192-168-1-110:~/.ssh$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter passphrase (empty for no passphrase): (忽略) Enter same passphrase again: (忽略) Your identification has been saved in /home/miao/.ssh/id_rsa. Your public key has been saved in /home/miao/.ssh/id_rsa.pub.
二、複製公密到服務器ide
miao@u32-192-168-1-110:~/.ssh$ scp id_rsa.pub miao@192.168.1.112:/home/miao/.ssh/192.168.1.110 miao@192.168.1.112's password: id_rsa.pub 100% 404 0.4KB/s 00:00 miao@u32-192-168-1-110:~/.ssh$
三、添加公密到192.168.112的信任區域spa
miao@debian-192-168-1-112:~/.ssh$ cat 192.168.1.110 >> authorized_keys miao@debian-192-168-1-112:~/.ssh$
四、啓動ssh-agent
若是ssh 192.168.112返回 Agent admitted failure to sign using the key
ps -Af|agent查看有無ssh-agent有無運行,若沒有orm
miao@u32-192-168-1-110:~/.ssh$ ssh-agent
五、添加id_rsa到ssh-agenthtm
miao@u32-192-168-1-110:~/.ssh$ ssh-add id_rsa
六、完成blog
轉自:http://www.jiangmiao.org/blog/559.htmlit