Ideas, drafts, and hacks

13 Aug 2022

SSH Port Forwarding

Something I do regulary is accessing a port from a server from my local machine. For this we use SSH Tunneling and the technique called port forwarding. The structure of the command is as follows:


To avoid login a session on the server, and send this task to process on background, we can add this flags:


And if you want to create a shortcut for this using a shell script, you can use this gist as a template.

And now you can type in your termnal this to foward server ports to your local machine.

# <port> <username> <server> 8080 carlos

Hope you find this helpful. See you next time.