I use SSH for managing linux servers. Sometimes I need to bind ports from the server to my client. I do this this way:

sudo ssh <serverUser>@<server> -L <localPort>:localhost:<serverPort>

Now sometimes I run into situations where I would like to bind several ports, like for instance port 80, port 443, port 8080, ...

Is that possible over SSH port binding?


I just tested multiple -L parameters on the same SSH command and it worked.

sudo ssh <serverUser>@<server> -L 80:localhost:80 -L 443:localhost:443


Ok, I was looking for quite some time for this and now, 5 minutes after posting the question here, one possibility pops to my head.

Open multiple terminals and bin the different needed ports one after one to the same server.

For instance:

On terminal 1: sudo ssh <serverUser>@<server> -L 80:localhost:80

On terminal 2: sudo ssh <serverUser>@<server> -L 443:localhost:443

On terminal 3: sudo ssh <serverUser>@<server> -L 8080:localhost:8080

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.