SSH Reverse Tunnel - ~/.ssh/config - PHP
My dads Laptop running Wheezy 64-bit and is behind NAT / Firewall.
I need sometimes connect the the machine over SSH to troubleshoot this or the other, when TeamViewer does not work. The usual SSH Reverse Tunnel he creates from his Laptop to remote SSH Server works the long way: Create Authorized Keys for password less login: ssh-keygen -t ecdsa -b 521 ssh-copy-id -i ~/.ssh/id_ecdsa.pub "my-Server@xxx.xxx.xxx.xxx -p 54321" or scp -P 54321 ~/.ssh/id_ecdsa.pub my-Server@xxx.xxx.xxx.xxx:.ssh/authorized_keys his-Laptop@xxx.xxx.xxx.xxx:12345 my-Server@xxx.xxx.xxx.xxx:54321 my-Laptop@@xxx.xxx.xxx.xxx:22222 SSH Reverse Tunnel: ssh -R 11111:localhost:12345 my-Server@xxx.xxx.xxx.xxx -p 54321 Then I connect from my-Laptop to the remote SSH server: my-Server@xxx.xxx.xxx.xxx -p 54321 And from my-Laptop connect to SSH tunnel connection on that SSH server: ssh his-Laptop@localhost -p 11111 I have found that I can store on his-Laptop the whole SSH Reverse Tunnel command into: vim ~/.ssh/config ######################################################################## Host reverse HostName xxx.xxx.xxx.xxx Port 54321 RemoteForward 11111 localhost:12345 User my-Server ######################################################################## And "ssh reverse" on his-Laptop works Then on my-Laptop create: vim ~/.ssh/config ######################################################################## Host my-Server HostName xxx.xxx.xxx.xxx Port 54321 User my-Server ######################################################################## "ssh my-Server" from my-Laptop does work And on my-Server the same: ######################################################################## Host his-Laptop HostName localhost Port 11111 User his-Laptop ######################################################################## "ssh his-Laptop" works as well But, I wanted to ask, is there any way that when he types "ssh reverse" on his-Laptop the Terminal windows will either close, or go into background (execute the command and close)? Or even better, have a PHP script that would do all this if he opened his web browser and clicked on pre-set link either stored locally or on my-Server? Or would cron job that would connect once his-Laptop starts be better option? |
Quote:
There's no taint checking in PHP, I wouldn't have him type anything into a terminal that gets passed to PHP without an error checking script to clean up the input. |
All times are GMT -5. The time now is 07:56 AM. |