SSH Port Forwarding

If you want til specify that a given port on the local (client) host is to be forwarded to the given host and port on the remote side. This works by allocating a socket to listen to port on the local side, and whenever a connection is made to this port, the connection is forwarded over the secure channel, and a connection is made to host port hostport from the remote machine. This could be useful if you e.g. are behind a proxy.

This is an example of forwarding port 2022, open a terminal and type

ssh -L 2022:<forwarded-host>:22 <username>@<remote-machine>

Now open another terminal and type

ssh -p 2022 <username-at-forwarded-host>@localhost

Or you can connect via SFTP with Cyperduck, Fugu etc.


This entry was posted in Mac OS X. Bookmark the permalink.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.