SSH Port Forwarding
Setup steps:
- Open
~/.ssh/config
in a text editor, creating it if it doesn't exist.
- Add an entry like the following, replacing brackets with that data:
Host <remote host shortname>
Hostname <fully qualified remote hostname>
User <username>
LocalForward <localhost:lport> <target:rport>
Then ssh to the given remote host shortname to connect. Connections to the localhost:lport address will now be redirected to target:rport on the other side of the tunnel.
- If you are only using this to tunnel, and don't want a shell prompt, use the "-N" flag.
- Similarly, the "-f" flag will send SSH to the background after asking for your password.
An example file:
Host remote
Hostname remote.research.acincenter.org
User jkopena
# For Wiki
LocalForward localhost:8000 www:443
# For Redmine
LocalForward localhost:8001 pm:3000
# For Jenkins
LocalForward localhost:8002 pm:8080