What is a privileged port on a Mac / Darwin?

What is a privileged port on a Mac / Darwin?

Recently I was trying to connect to a remote SSH server using my MacBook. At one point when trying to configure a Tunnel I got an error saying:

Privileged ports can only be forwarded by root

My first instinct was to make sure I had root access on the remote server and on the local one. I realized I needed to use sudo to launch SSH to avoid this error. But clearly that was not the best workaround.

I did a little digging to see what were these “privileged ports” and learn more about them. It turns out for some reason Mac OSX has a restriction on binding all ports below 1024. I am guessing this is because long time ago every application that matter grabbed some of those ports (think 80 and 443 por the Internet, FTP, SMTP, etc.) so probably that opens room for security issues. Regardless I simply decided to bind a port about 1024 and that avoided the need to use root access. If you have the flexibility to change the local binding port then that’s probably the best route.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

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