ssh免密码登录
最近在服务器与服务器之间传文件,老是输入密码让我很烦躁,决定采用ssh key的方式来进行无密码互传,好了,看教程吧.
系统:centos 5.4
客户机A:192.168.1.253
远端主机B:192.168.1.254
原理:密钥相当于一把钥匙,而公钥就相当于一把门锁,我们当然是拿着钥匙去开锁,同样的道理,我们密钥放在本地服务器,也就是客户机A,把公钥放在远程服务器,也就是远端主机B,那么我们就可以从客户机A ssh免密码登陆远端主机B.
1.如果用户主目录下没有.ssh文件夹,可以执行以下命令
ssh连接的时候出现Host key verification failed.
今天在服务器上执行远程操作命令出现以下的问题:
[root@www ~]# ssh 205.209.161.**
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
6c:74:2a:d5:ae:2b:76:51:*:*.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:20
RSA host key for 205.209.161.** has changed and you have requested strict checking.
Host key verification failed....
控制ssh连接时间(转)
公司刚换了成电信的网络,啥也不没有改过,连上服务器后,如果超过30s左右没有动,就自动断开
我想就此问题和大家探讨一下。
原因分析:a packet filter or NAT device timing out your TCP connection due to inactivity
一般由于我们的tcp连接没有活动而被firewall认为超时中断了会话。
Many NAT firewalls time out idle sessions after a certain period of time to keep their trunks clean. Sometimes the interval between session drops is 24 hours, but on many commodity firewalls, connections are killed after as little as 300 seconds.
解决方法:
#vi /etc/ssh/ssh_config
添加以下两行:
ServerAliveInterval 300
ServerAliveCountMax 2
不过在官方FAQ中看到ServerAliveInterval 只能在OpenSSH 3.8 and newer才能使用。