#! /bin/bash # SSHTunell.sh - michaelk - v0.3 # Find pid and display it for an easiest kill # SSHTunnel.sh - ToM - v0.2 # Create a SSH tunnel between localhost and a shell # ./Configure # Set here the local port. Make sure to choose an unused one :p localport=60000 # Set here the server's host where you're gonna login: sshhost=caca.org # Set here the irc server you want to be connected to: ircserver=irc.prout.org # Banner echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "SSH Tunneling from localhost:$localport" echo "Binded to $ircserver using $sshhost" echo "/server localhost $localport" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" # Finally create the tunnel. ssh -f -N -L$localport:$ircserver:6667 $sshhost # Find the pid and display it pidtokill=`ps -ef | grep $sshhost |grep $ircserver |cut -d " " -f2` echo "kill -9 $pidtokill to remove the tunnel"