What exactly are user ports?
I was a little confused
I noticed that:
Well-known ports, are predefined ports on servers that are used to connect the client to the server. (that reserved in IANA)
Dynamic ports, are ports that the client temporarily selects at random to communicate with the server. (they are not reserved at IANA)
But I do not know exactly what user ports are. I only know about them that they are reserved in IANA by certain entities for certain services but if so, what is the difference between well-known ports and them?
Well-known ports are defined as ports with their number less than 1024. Listening on these ports is usually allowed only to processes running as superuser (root in Linux terminology, see below).
Ports with higher number, also known as user ports or registered ports are ports in range 1024–49151 and any user can listen on them.
This restriction are typically enforced on Unix-like systems.
And finally, highest-numbered ports, in range 49152–65535 are typically used only for temporary connections. They are usually assigned to client applications. These ports are called ephemeral or dynamic.
Few words about superusers
Superuser account (not to be confused with this Q&A site), usually known as root
, sometimes with alternaive names such as toor
is on Unix-like operating systems (Linux, BSD-like systems etc.) the user account that has allowed to do everything and minimal restrictions are imposed to it. It is defined by having UID set to 0 This user account is similar to Windows administrator account.
This user is allowed to listen (or more precisely bind) on ports below 1024 and therefore it is allowed to provide services on well-known ports. Many programs that need to use this port number run as root (but they usually switch their user for other work than networking). This limitation should prevent ordinary users from pretending to be owner of the machine that can provide “well-known” services such as SSH (port 22), HTTP(S) (ports 80, 443), FTP and others.