Skip to main content

Tag: Ssh

Tunneling to a remote machine via ssh

Update: For the most part, I want to tunnel from the server to the local machine. This only works with the localhostname set to localhost, for example to tunnel a mysql server to the current machine port 10101:

ssh -L 10101:localhost:3306 user@remoteserver.com -N

The localhost is important, and in this case the mysql client (on the local machine) has to have the hostname set to 127.0.0.1 (for some reason localhost doesnt work).  Ive been trying to access my works MySQL database from outside the universities firewall and was having issues. Im still having issues but thats another story: Ill get to that. Some definitions: the local machine is my machine accessing the server from outside the firewall, and the server machine is the one running the server and is behind the firewall. My initial test was to run a rails server (which runs on port 3000) on the server machine. It serves a basic test page just to show it works.  To set up a tunnel, I used the following command: