Server Administration & Management

How to SSH Port Forwarding without starting a new session

You can forward ports with ssh like this:

# ssh -L 8888:localhost:80 user@remotehost

This will log you into remotehost as user, and port 8888 on your local machine will be tunnelled to port 80 on remotehost. If remotehost can see a machine that you can’t (for example, if it’s on an internal network), you can even do this:

# ssh -L 8888:internalhost:80 user@borderhost

This will log you in to borderhost, and localhost:8888 will be directed to internalhost:80, even though you may not be able to see internalhost directly yourself.

January 17, 2013 Posted by | SSH | , | 5 Comments