Gentoo Wiki ArchivesGentoo Wiki



SSH Basics

Tips & Tricks

Other Gentoo-wiki SSH



If you want to use knockd on your server and autossh on your client you get the problem that autossh is not able to knock the server before establish a new connection.


You can use a wrapper ssh script to solve this. Place this script in a path where the original ssh-binary is not and not in the $path, for example in /etc/ppp, replace $YOURSERVER and $KNOCKSEQUENCE

test -e $PID && kill -9 `cat $PID` ; rm $PID
/usr/bin/ssh $@ &
echo $! > $PID

Now tell autossh to use this wrapper, and start autossh

export AUTOSSH_PATH=/etc/ppp/ssh
autossh ...

At this time on every connection autossh calls the wrapper-script. The wrapper knocks the server and then call the original ssh-binary.

Retrieved from ""

Last modified: Sat, 06 Sep 2008 23:42:00 +1000 Hits: 13,826

Created by, Luxury Homes Australia
Real estate agents should list their apartments, townhouses and units in Australia.