SSH disconnects when inactive
Hello All,
I am using RHEL 5.2 and this is quite surprising situation when I use putty to connect to my remote machine it regularly gets disconnected when kept inactive for few minutes then I need to relogin to start my work. But again this happens with only one server and all the other servers in which I login, there is no such problem. I did a bit google and came up with this site http://www.walkernews.net/2008/05/11...-disconnected/ But my concern is why ut happens with only one server? Is my sshd_config has any thing to do with it? Kindly tell me where to look out for the solution |
Some things to check in sshd_config
TCPKeepAlive, ClientAliveCountMax, ClientAliveInterval. |
Quote:
Thanks for the reply I know about these things but I want to know why this happens with only one server and not others as I checked sshd_config of other machines as well and I don't see any changes but the only difference is they seem to work properly and never gets disconnected? |
try tailing the secure log in one session
Code:
tail -f /var/log/secure I havent used putty in years so i dont know much about it now, but as your link suggests, it may be doing something to disconnect after inactivity.. What happens if you ssh from a different linux host to the problematic one? (to isolate if it is a putty/client, or server problem. |
Quote:
Code:
Dec 19 21:35:28 server sshd[2741]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=10.10.10.30 user=root the session gets disconnected in a while with this error message Code:
Read from remote host 192.168.0.195: Connection reset by peer |
Nothing stands out to me there...
But a couple more ideas worth trying.. To get more info out of the error. try adding -vvv to the ssh command. and stopping the sshd process on the server, and running it from the commandline with debugging increased. Code:
sshd -ddd & Is the shell inactivity timeout set to something silly? IIRC 0, means the shell wont time out. On the ssh SERVER, run the below, it can be set permenantly in .bashrc. Code:
echo $TMOUT Is there a firewall inbetween the client and server, that could be dropping inactive connections? Just some food for thought anyway... |
I changed the
Code:
ClientAliveInterval 300 I'll try your steps but today office time over so will get back on monday till then HAPPY NEW YEAR :) |
Now I did some changes
Code:
ClientLiveInterval 60 I logged in using Code:
#ssh -vvv 192.168.0.195 Code:
[root@server ~]# debug1: client_input_channel_req: channel 0 rtype keepalive@ope nssh.com reply 1 But still even if the problem is solved I don't get any answer to my question that why it happens only on one server where all other session works fine without any changes? I also tried adding this line Code:
ServerAliveInterval 60 Code:
Bad configuration option: ServerAliveInterval |
Quote:
Quote:
Quote:
|
Quote:
Do you have any possible ideas which might be the reason for such issue? I have installed sendmail+apache+squirrelmail on this server and nothing else But it seems while restarting ssh is unable to recognise the syntax used for ServerAliveInterval does it has anything to be done with distro used? |
Quote:
Quote:
ClientAliveInterval, is set in sshd_config, on the server. I believe that to be the same for all distro's. |
Quote:
Yes its working when placed in ssh_config Well, Thanks for your help :) |
All times are GMT -5. The time now is 08:48 AM. |