This is a question on Unix software development. I have seen the following questions, which gave rise to my question:

Suppose you are building a service which you later want to package and publish for the Linux distro, and it involves networking. You are making everything by scratch (like not using ssh or HTTP etc.), so you will need some default ports for communication. How does the community (or whoever is responsible) decide which port is to be used and make it reserved?

  • You seem to have two questions here: One about programming, and the other about how the community allocates ports. Only ask one question at a time. You can ask as many questions as you wish, but one question per question. Jul 21, 2020 at 16:37
  • Having read the question more thoroughly I now realise that there is one question. However I think the linked questions distract from the meaning of your question. Jul 21, 2020 at 16:45
  • Thanks for editing! There is confusion on my part that why I have not framed my question firmly. I actually want to know about the process, meaning what role the developer as well as the community which maintains the distro for which the developer is writing the software, plays for assigning a reserved port? Jul 21, 2020 at 16:47
  • @ctrl-alt-delor I apologize for hasty writing of the question, the links that I have posted actually are the reason for this question to arise as they say 'some ports are reserved for root where only specific protocols run' so I wondered how one developer gets that port if he wants to build some widely applicable utility like http or ssh. Does this clarify more? Jul 21, 2020 at 16:50

1 Answer 1


Read the content of /etc/services. There are a few comments that will shed some light on this.


# Network services, Internet style
# Note that it is presently the policy of IANA to assign a single well-known
# port number for both TCP and UDP; hence, officially ports have two entries
# even if the protocol doesn't support UDP operations.
# Updated from https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml .
# New ports will be added on request if they have been officially assigned
# by IANA and used in the real-world or are needed by a debian package.
# If you need a huge list of used numbers please install the nmap package.


# The remaining port numbers are not as allocated by IANA.
# Services added for the Debian GNU/Linux distribution
# Local services

These are not the only comments in the file.

From this I see a section of ports assigned by IANA. A section that are documented by IANA (but not assigned by), a section assigned by Debian (I am running Debian Gnu/Linux), and a section for me to add locally used ports.

See these pages for more information

The second link above has information on how to register a port. You can also register just a name (ports can be looked up for a particular end-point using DNS).

How would you go about getting a port registered for your software

Step one

Get popular: You won't convince anyone until your software is popular.

What to do now.

Choose a port that is not in use. Chose a default, but make it configurable.

Low numbered ports (reserved for root, or capability CAP_NET_BIND_SERVICE)

You can use these if you have control over the machine. The advantage on a multi user machine, is other users can not use the port: steal the port (DOS), use the port (fake site), etc.

  • Probably more important to choose a unique service name (but also to keep that configurable as much as possible in case of future clashes). As long as you are developing, you can put any port number into /etc/services that follows the conventions and does not conflict with anything else. Restricted applications (like a bespoke system sold to a few hundred customers) don't really need IANA approval because you can fix conflicts easily. When your app is going to conquer the world, you need to plan for IANA approval. Jul 21, 2020 at 17:00
  • There’s no popularity requirement for IANA assignments, it’s possible to request a port number for a new service which isn’t widely used yet. Jul 21, 2020 at 17:18
  • @StephenKitt Agreed, but it looks like the ultimate namespace in respect of pollution. I'm surprised Apple and Google have not claimed every slot already. Jul 22, 2020 at 8:46

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.