1SERVICES(5) Linux Programmer's Manual SERVICES(5)
2
3
4
6 services - Internet network services list
7
9 services is a plain ASCII file providing a mapping between human-
10 friendly textual names for internet services, and their underlying
11 assigned port numbers and protocol types. Every networking program
12 should look into this file to get the port number (and protocol) for
13 its service. The C library routines getservent(3), getservbyname(3),
14 getservbyport(3), setservent(3), and endservent(3) support querying
15 this file from programs.
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 be bound
23 to only 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 <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
54 tcp and udp.
55
56 aliases is an optional space or tab separated list of other names for
57 this service. Again, the names are case sensitive.
58
59 Either spaces or tabs may be used to separate the fields.
60
61 Comments are started by the hash sign (#) and continue until the end of
62 the line. Blank lines are skipped.
63
64 The service-name should begin in the first column of the file, since
65 leading spaces are not stripped. service-names can be any printable
66 characters excluding space and tab. However, a conservative choice of
67 characters should be used to minimize compatibility problems. For
68 example, a-z, 0-9, and hyphen (-) would seem a sensible choice.
69
70 Lines not matching this format should not be present in the file.
71 (Currently, they are silently skipped by getservent(3), getservby‐
72 name(3), and getservbyport(3). However, this behavior should not be
73 relied on.)
74
75 This file might be distributed over a network using a network-wide nam‐
76 ing service like Yellow Pages/NIS or BIND/Hesiod.
77
78 A sample services file might look like this:
79
80 netstat 15/tcp
81 qotd 17/tcp quote
82 msp 18/tcp # message send protocol
83 msp 18/udp # message send protocol
84 chargen 19/tcp ttytst source
85 chargen 19/udp ttytst source
86 ftp 21/tcp
87 # 22 - unassigned
88 telnet 23/tcp
89
91 /etc/services
92 The Internet network services list
93
94 <netdb.h>
95 Definition of _PATH_SERVICES
96
98 listen(2), endservent(3), getservbyname(3), getservbyport(3), getser‐
99 vent(3), setservent(3), inetd.conf(5), protocols(5), inetd(8)
100
101 Assigned Numbers RFC, most recently RFC 1700, (AKA STD0002).
102
104 This page is part of release 5.04 of the Linux man-pages project. A
105 description of the project, information about reporting bugs, and the
106 latest version of this page, can be found at
107 https://www.kernel.org/doc/man-pages/.
108
109
110
111Linux 2010-05-22 SERVICES(5)