Re: [linux-392] Ports

From: badiane
Sent on: Monday, June 16, 2008 4:57 PM
Something felt wrong about my answer and I went to confirm my suspicion.

Here is the man page definition:

####################­####################­####
SERVICES(5)                                                                               Linux Programmer���s Manual                                                                              SERVICES(5)

NAME
       services - Internet network services list

DESCRIPTION
       services  is  a  plain  ASCII file providing a mapping between friendly textual names for internet services, and their underlying assigned port numbers and protocol types.  Every networking program
       should look into this file to get the port number (and protocol) for its service.  The C library routines getservent(3), getservbyname(3), getservbyport(3), setservent(3), and endservent(3) support
       querying this file from programs.

       Port  numbers are assigned by the IANA (Internet Assigned Numbers Authority), and their current policy is to assign both TCP and UDP protocols when assigning a port number.  Therefore, most entries
       will have two entries, even for TCP only services.

       Port numbers below 1024 (so-called ���low numbered��� ports) can only be bound to by root (see bind(2), tcp(7), and udp(7)).  This is so clients connecting to low numbered ports can trust that the ser���
       vice  running on the port is the standard implementation, and not a rogue service run by a user of the machine.  Well-known port numbers specified by the IANA are normally located in this root-only
       space.

       The presence of an entry for a service in the services file does not necessarily mean that the service is currently running on the machine.  See inetd.conf(5) for the configuration of Internet ser���
       vices  offered.   Note that not all networking services are started by inetd(8), and so won���t appear in inetd.conf(5).  In particular, news (NNTP) and mail (SMTP) servers are often initialized from
       the system boot scripts.

       The location of the services file is defined by _PATH_SERVICES in <netdb.h>.  This is usually set to /etc/services.
####################­####################­#######

So every service looks at it to find out what its port(s) should be and may be otherwise changed or new services may be added.

So Michelle, I would say that it's more a matter of convention.  The file is a central point of reference for many things and it's best to change the daemon's conf file.

Badiane




People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy