Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Binding on privileged ports (ports < 1024) on Mac OS X 10.6

Do you know how to remove restriction on binding to ports < 1024 with a user account that is not root on Mac OS X?

like image 520
Nicu B. Avatar asked Sep 30 '11 14:09

Nicu B.


People also ask

Is 1024 a privileged port?

Information. The TCP/IP port numbers below 1024 are considered privileged ports. Normal users and processes are not allowed to use them for various security reasons.

Why a port lower than 1024 Cannot be used?

Priviliged ports The TCP/IP port numbers below 1024 are special in that normal users are not allowed to run servers on them. This is a security feaure, in that if you connect to a service on one of these ports you can be fairly sure that you have the real thing, and not a fake which some hacker has put up for you.

What ports are open macOS?

How to Find Open Ports on a Mac. You can find what ports are open on an OS X version of Mac fairly easily by doing the following: STEP 1: Open “Network Utility,” located in the “Utilities” folder in the “Applications” folder, and click “Port Scan.” STEP 2: Type your IP address, and then click the “Scan” button.

What ports are open Mac terminal?

On a Mac computer (earlier than macOS 11 Big Sur)Type "Network Utility" in the search field and select Network Utility. Select Port Scan, enter an IP address or hostname in the text field, and specify a port range. Click Scan to begin the test. If a TCP port is open, it will be displayed here.


1 Answers

The best way is to leverage launchd. The restriction on binding to ports < 1024 will still be there and is not likely to go anywhere, but if your app requests elevated privileges once in order to add the necessary launchd configuration, then you can let launchd do the actual listening on the privileged port and pass the socket to your app when appropriate.

See the section on launchd in this OS X Developer Library reference, and the further references given there for learning more about launchd and how to use it safely.

like image 71
the paul Avatar answered Sep 25 '22 02:09

the paul