1services(5) File Formats 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 as‐
11 signed 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 Au‐
18 thority), and their current policy is to assign both TCP and UDP proto‐
19 cols 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 un‐
47 der. It is case sensitive. Often, the client program is named
48 after the service-name.
49
50 port is the port number (in decimal) to use for this service.
51
52 protocol
53 is the type of protocol to be used. This field should match an
54 entry in the protocols(5) file. Typical values include tcp and
55 udp.
56
57 aliases
58 is an optional space or tab separated list of other names for
59 this service. Again, the names are case sensitive.
60
61 Either spaces or tabs may be used to separate the fields.
62
63 Comments are started by the hash sign (#) and continue until the end of
64 the line. Blank lines are skipped.
65
66 The service-name should begin in the first column of the file, since
67 leading spaces are not stripped. service-names can be any printable
68 characters excluding space and tab. However, a conservative choice of
69 characters should be used to minimize compatibility problems. For ex‐
70 ample, a-z, 0-9, and hyphen (-) would seem a sensible choice.
71
72 Lines not matching this format should not be present in the file.
73 (Currently, they are silently skipped by getservent(3), getservby‐
74 name(3), and getservbyport(3). However, this behavior should not be
75 relied on.)
76
77 This file might be distributed over a network using a network-wide nam‐
78 ing service like Yellow Pages/NIS or BIND/Hesiod.
79
80 A sample services file might look like this:
81
82 netstat 15/tcp
83 qotd 17/tcp quote
84 msp 18/tcp # message send protocol
85 msp 18/udp # message send protocol
86 chargen 19/tcp ttytst source
87 chargen 19/udp ttytst source
88 ftp 21/tcp
89 # 22 - unassigned
90 telnet 23/tcp
91
93 /etc/services
94 The Internet network services list
95
96 <netdb.h>
97 Definition of _PATH_SERVICES
98
100 listen(2), endservent(3), getservbyname(3), getservbyport(3), getser‐
101 vent(3), setservent(3), inetd.conf(5), protocols(5), inetd(8)
102
103 Assigned Numbers RFC, most recently RFC 1700, (AKA STD0002).
104
105
106
107Linux man-pages 6.05 2022-10-30 services(5)