* Download and compile sshpass and place in DIR http://sshpass.sourceforge.net/ * Create a script like this DIR=/? LOG=$DIR/ssh.log LOCAL_PORT=15000 REMOTE_SERVER=192.168.69.69 REMOTE_PORT=1521 echo "`date` - Restarting " >> $LOG export SSHPASS='PASSWORD' $DIR/sshpass -e ssh $USERNAME@ $REMOTE_SERVER -L${LOCAL_PORT}:localhost:${REMOTE_PORT} -N -o ServerAliveInterval=30 -o TCPKeepAlive=yes -o ServerAliveCountMax=172800 echo "`date` - Ending " >> $LOG * Add the following to /etc/inittab - replace xxxx with a unique id, USER with the user to login as and and script.sh accordingly with full path xxxx:35:respawn:/bin/su - USER "/?/script.sh" * Get the init process to reload (as root) kill -HUP 1 * Test |
Friday, 19 November 2010
Keeping an SSH tunnel (passworded) running perniciously
Posted by Ook at 06:14
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment