I wanted to forward my local 8080 port to the 80 port of the server I want to log in via SSH, so I did:

ssh -L 80: -N -f myserver

But I get the error:

Privileged ports can only be forwarded by root.

I can execute sudo commands when logged in that server, but how can I do it for the purposes of port forwarding? (Note: appending sudo at the beginning of this command doesn't help, because the port 80 is not the port I want to use in localhost, but the port I want to target.)


You probably want

ssh -L 8080: -N -f myserver

Local port comes first. (That's not my political stance!)

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.