Use Reverse SSH for Across Something(2)

TurnToJPG -->

###ssh command Take following command for detailed example of using ssh:

	alias mydaili='ssh -qTfnN -D '
	-q Quite Mode
	-T Disable pseudo-tty allocation
	-f background the ssh
	-n redirect the stdin from /dev/null
	-N Don't execute a remote command
	-D Bind address

###Using rsh rsh could be used for executing the command remotely, thus in my family’s debian machine I could write following script:

	cat /bin/remoteON 
	rsh -l root localhost -p 4381  ssh -qTfnN -L 1XX.XXX.XXX.XXX:9004:1XX.XXX.XXX.XXX:8000 &
	chmod 777 /bin/remoteON

For killing the remote machines’s running ssh tunnel process, write another script:

	#Fetch the ssh id
	sshid=`rsh -l root localhost -p 4381 ps | grep "ssh -qTfnN" | awk '{print $1}'`
	#Kill the selected process
	rsh -l root localhost -p 4381 kill $sshid
	$ chmod 777 /bin/remoteOFF

###Write the local script Local Scripts is for calling the remoteON and remoteOFF.
Script for starting the proxy

#Start the openWRT Tunnel
rsh -l root /bin/remoteON &
#Sleep 3 seconds
sleep 3
#Start the Debian Tunnel
rsh -l root ssh -qTfnN -L root@localhost -p 4381 &

Script for stopping the proxy

# Stop the openWRT Tunnel:
rsh -l root /bin/remoteOFF &
# Sleep 3 seconds
sleep 3
# Stop the Debian Tunnel
sshid=`rsh -l root ps -ef | grep "ssh -qTfnN" | awk '{print $2}'`
rsh -l root kill $sshid &

###How to use it? If you want to use proxy, simply ./
After using the proxy, you can ./ for totally release the connection and release the resources.