On Tue, Apr 15, 2008 at 11:33:54AM +0000, tony.chamberlain@xxxxxxxxx wrote: > > > > The following is for CentOS 4.5 > We have an internal network (192.168.5.0/255.255.255.0). > We have one machine reachable from inside and outside > (NOT on the 192.168.5 network). Just for this example > call it 10.20.30.40 (though that is not its real address. > I don't put the real address, for security concerns here). > Anyway my machine is 192.168.5.19 so from my machine > I do an > ssh -l root -R 10022:127.0.0.1:22 10.20.30.40 > Then I log into 10.20.30.40 from another machine and do a > ssh -l tony -p 10022 127.0.0.1 > which gets me into my machine. Test passes. Problem is, by > the time I get home, my ssh -l root -R 10022:127.0.0.1:22 10.20.30.40 > has timed out or something and I can no longer get to my local machine. > Do you know what I can do to keep it from timing out (or maybe locking up)? > I do have root access to both machines so if there is something in > sshd_config to change, I can do it. I have a cron job which runs the script below every 15 minutes to see if the ssh is still running and restart it if it isn't:- # # # Script to set up a secure tunnel from home system # cn=`ps -ef | grep "ssh -l chris -R 50022:apollo:22 -N xx.yy.zz.aa" | grep -v 'grep ssh'` if [ -n "$cn" ] then echo `date` "hssh is running" >/home/chris/tmp/hssh.log else /proj/chris/bin/ssh -l chris -R 50022:apollo:22 -N xx.yy.zz.aa fi It means that even if there *is* a connection which has got screwed up for some reason I can kill the ssh running on my home machine and within 15 minutes the cron job and script above will start a new session. -- Chris Green