现有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