Note: This article was originally published in 2014. Some steps, commands, or software versions may have changed. Check the current Mac OS documentation for the latest information.

This article explains a privileged port on a mac / darwin? and why it matters for your environment. macOS is Apple’s desktop operating system, known for its Unix-based architecture, security, and integration with the Apple ecosystem.

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 (http://www.apple.com/osx “OS X”) 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.