LINUX配置双机SSH信认,并用public key认证登录
http://blog.itpub.net/15693674/viewspace-767572/
[[email protected]]$catid_dsa.pub>>authorized_keys
#将本机vrh1上的dsa保存到授权文件中
[[email protected]]$catid_rsa.pub>>authorized_keys
#将本机vrh1上的rsa保存到授权文件中
[[email protected]]$sshvrh2cat~/.ssh/id_dsa.pub>>authorized_keys
#将vrh2上的dsa保存到授权文件中
LinuxServer1:192.168.1.104
LinuxServer2:192.168.1.105
终端:SSHSecureShellClient
1.用password方式登录LinuxServer1和2
2.在LinuxServer1上命令操作如下:两台服务器都要输入
#ssh-keygen-tdsa
并三次回车
#cd.ssh/
#cpid_dsa.pubauthorized_keys
#chmod600authorized_keys
#scp-P22*[email protected]:/root/.ssh
报错:RSAhostkeyformysharebook.cnhaschangedandyouhaverequestedstrictchecking.
Hostkeyverificationfailed.
解决方法:
这是Linux重装或则openssh-server重装引起的,执行以下命令即可
ssh-keygen-R192.168.87.36192.168.87.36换成你要连的服务器就可以了。
其中在scp的时候会提示Areyousureyouwanttocontinueconnecting(yes/no)?
确定输入yes进行确认,之后会提示[email protected]′spassword:要求输入root密码
我们在LinuxServer1(192.168.1.104)上ssh连接LinuxServer2(192.168.1.105),看下是否正常
#ssh192.168.1.105
然后在LinuxServer2(192.168.1.105)上ssh连接LinuxServer1(192.168.1.104),看下是否正常
如果提示:Areyousureyouwanttocontinueconnecting(yes/no)?输入yes即可
到目前为止已经配置好LinuxServer1和LinuxServer2的SSH互相信任,SSH连接并不需要密码