1SERVICES(5)                Linux Programmer's Manual               SERVICES(5)
2
3
4

NAME

6       services - Internet network services list
7

DESCRIPTION

9       services  is  a  plain  ASCII file providing a mapping between friendly
10       textual names for internet services, and their underlying assigned port
11       numbers  and  protocol types. Every networking program should look into
12       this file to get the port number (and protocol) for its service.  The C
13       library  routines  getservent(3),  getservbyname(3),  getservbyport(3),
14       setservent(3), and endservent(3) support querying this file  from  pro‐
15       grams.
16
17       Port  numbers  are  assigned  by  the  IANA  (Internet Assigned Numbers
18       Authority), and their current policy is to assign both TCP and UDP pro‐
19       tocols  when assigning a port number. Therefore, most entries will have
20       two entries, even for TCP only services.
21
22       Port numbers below 1024 (so-called 'low numbered' ports)  can  only  be
23       bound to by root (see bind(2), tcp(7), and udp(7)).  This is so clients
24       connecting to low numbered ports can trust that the service running  on
25       the port is the standard implementation, and not a rogue service run by
26       a user of the machine.  Well-known port numbers specified by  the  IANA
27       are normally located in this root-only space.
28
29       The  presence  of  an entry for a service in the services file does not
30       necessarily mean that the service is currently running on the  machine.
31       See  inetd.conf(5)  for the configuration of Internet services offered.
32       Note that not all networking services are started by inetd(8),  and  so
33       won't  appear  in  inetd.conf(5).   In particular, news (NNTP) and mail
34       (SMTP) servers are often initialized from the system boot scripts.
35
36       The location of the services  file  is  defined  by  _PATH_SERVICES  in
37       /usr/include/netdb.h.  This is usually set to /etc/services.
38
39       Each line describes one service, and is of the form:
40
41              service-name   port/protocol   [aliases ...]
42
43       where:
44
45       service-name
46                 is  the  friendly  name the service is known by and looked up
47                 under. It is case sensitive. Often,  the  client  program  is
48                 named after the service-name.
49
50       port      is the port number (in decimal) to use for this service.
51
52       protocol  is  the  type of protocol to be used. This field should match
53                 an entry in the protocols(5) file. Typical values include tcp
54                 and udp.
55
56       aliases   is an optional space or tab separated list of other names for
57                 this service (but see the BUGS  section  below).  Again,  the
58                 names are case sensitive.
59
60       Either spaces or tabs may be used to separate the fields.
61
62       Comments are started by the hash sign (#) and continue until the end of
63       the line. Blank lines are skipped.
64
65       The service-name should begin in the first column of  the  file,  since
66       leading  spaces  are  not stripped.  service-names can be any printable
67       characters excluding space and tab. However, a conservative  choice  of
68       characters should be used to minimize inter-operability problems. E.g.,
69       a-z, 0-9, and hyphen (-) would seem a sensible choice.
70
71       Lines not matching this format should not be present in the file. (Cur‐
72       rently,  they  are silently skipped by getservent(3), getservbyname(3),
73       and getservbyport(3).  However, this behaviour  should  not  be  relied
74       on.)
75
76       As  a  backwards  compatibility feature, the slash (/) between the port
77       number and protocol name can in fact be either a slash or a comma  (,).
78       Use of the comma in modern installations is depreciated.
79
80       This file might be distributed over a network using a network-wide nam‐
81       ing service like Yellow Pages/NIS or BIND/Hesiod.
82
83       A sample services file might look like this:
84
85              netstat         15/tcp
86              qotd            17/tcp          quote
87              msp             18/tcp          # message send protocol
88              msp             18/udp          # message send protocol
89              chargen         19/tcp          ttytst source
90              chargen         19/udp          ttytst source
91              ftp             21/tcp
92              # 22 - unassigned
93              telnet          23/tcp
94
95

BUGS

97       There is a maximum of 35 aliases, due to the way the getservent(3) code
98       is written.
99
100       Lines longer than BUFSIZ (currently 1024) characters will be ignored by
101       getservent(3), getservbyname(3), and getservbyport(3).   However,  this
102       will also cause the next line to be mis-parsed.
103

FILES

105       /etc/services
106              The Internet network services list
107
108       /usr/include/netdb.h
109              Definition of _PATH_SERVICES
110

SEE ALSO

112       listen(2),  endservent(3),  getservbyname(3), getservbyport(3), getser‐
113       vent(3), setservent(3), inetd.conf(5), protocols(5), inetd(8)
114
115       Assigned Numbers RFC, most recently RFC 1700, (AKA STD0002)
116
117       Guide to Yellow Pages Service
118
119       Guide to BIND/Hesiod Service
120
121
122
123Linux                             1996-01-11                       SERVICES(5)
Impressum