I have two desktop machines which I would like to do screen sharing (vnc connection) with (Machine A -> Machine C).
But I would like to connect via a SSH tunnel on Machine B.
How can I do this? Both machines are OS X Mavericks
Let's say that you want to share the screen on Machine A with Machine C, going through Machine B because A and C can't connect together directly. You need to forward the VNC port from B to A to allow VNC clients on B to connect. On Machine A, run:
ssh -R 5900:localhost:5900 $MACHINE_B
This makes it so that connections to the VNC port on B are forward to A. On machine C run:
ssh -L 5900:localhost:5900 $MACHINE_B
This makes it so that connections to the VNC port on C are forward to B, and then onwards to A.
5900 is the most likely possibility for the VNC port, but your VNC server may choose a different port. Check its output when starting.
I'm trying to use an ssh tunnel from a remote location to connect to my home network and access the router web interface.
I have SSH access to the home network, and I can connect to the gateway machine "Lounge". (e.g. 192.168.1.100)
What would I need to do to proxy web requests to the router (192.168.1.1) on the home network, via "Lounge", so that I can view it from the remote location?
If it makes a difference, the "Lounge" machine is running OS X.
I want an ssh / command-line only solution to this, thanks.
Download putty if you don't already have it, the format you need for this is:
putty -ssh username@publicip -pw password -L localport:privateip:destinationport
Here is what you would use to get to 192.168.1.1 remotely through SSH:
putty -ssh username@publicip -pw password -L 8080:192.168.1.1:80
You could then open up a web browser to 127.0.0.1:8080 on the computer you created the tunnel with and up would pop the router interface.
The straight ssh command for this without puTTY is...
ssh user@host -L localport:routerip:remoteport
and then open http://localhost:localport in your browser.
Thanks to MaQleod for showing me the ssh switches.
(P.S. Don't go putting passwords in plaintext! avoid the -pw switch)