Welcome to WebmasterWorld Guest from 174.129.135.89

Forum Moderators: bakedjake

Message Too Old, No Replies

SSH: Read from Remote Host *: Operation Timed Out

Connection to * closed

   
11:03 pm on Sep 10, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm having trouble with my SSH connection from my Mac OS X laptop (behind a firewall, ports 22,23,6000-6010 open) to a remote machine running Fedora. My ssh connection is timing out after several minutes of inactivity which makes it difficult to get anything done. I've even tried starting xclock on the remote machine and it starts and runs but doesn't force the connection to stay open.
When I log in to the remote machine from my local Fedora box (no firewall) the connection stays open for days.
I've seen info on this before and one of the things mentioned is the TCPKeepAlive direcive. In my .ssh/config file I have TCPKeepAlive yes. This doesn't seem to help though.
Could it be there are other ports I need to open? Anyone know what's going wrong here?
9:30 am on Sep 11, 2006 (gmt 0)

WebmasterWorld Senior Member lammert is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



I have had this problem before. You need to make some changes in sshd_config, which is probably in your /etc/ssh directory. I first tried the KeepAlive, but this is a TCP type keep alive check which only keeps the connection between the firewall and server going. The connection with the client may die without notice.

Therefore after some testing I added the following to my sshd_config:

ClientAliveInterval 15
ClientAliveCountMax 5

The ClientAlive messages are sent over the encrypted channel between the endpoints of the connection, i.e. de server and the client. They will pass through the firewall. This will keep your connection running, even if it is idle for a long time.

6:42 pm on Sep 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks lammert. Do you mean edit the /etc/ssh/sshd_config on the remote machine? In this situation I can't edit that file as the remote server doesn't belong to me.
8:21 pm on Sep 11, 2006 (gmt 0)

WebmasterWorld Senior Member lammert is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Yes, I mentioned the remote machine. The sshd process should send out periodical queries to the client to see if it is still alive. I have looked in the SSH manual and couldn't find an equivalent setting on the client side.
8:35 pm on Sep 11, 2006 (gmt 0)

10+ Year Member



Theres also a setting "ServerAliveInterval #*$!" (where #*$! is a number of seconds) which you can add to your .ssh/config etc. , this makes the client refresh the connection periodically.

(My DSL modem died at the weekend and the replacement started cutting off my idle SSH connections).

1:41 am on Sep 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks zCat, that seems to have worked! Also thanks lammert for looking :)