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 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 <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 (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 compatibility 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.
72 (Currently, they are silently skipped by getservent(3), getservby‐
73 name(3), and getservbyport(3). However, this behavior should not be
74 relied on.)
75
76 This file might be distributed over a network using a network-wide nam‐
77 ing service like Yellow Pages/NIS or BIND/Hesiod.
78
79 A sample services file might look like this:
80
81 netstat 15/tcp
82 qotd 17/tcp quote
83 msp 18/tcp # message send protocol
84 msp 18/udp # message send protocol
85 chargen 19/tcp ttytst source
86 chargen 19/udp ttytst source
87 ftp 21/tcp
88 # 22 - unassigned
89 telnet 23/tcp
90
92 /etc/services
93 The Internet network services list
94
95 <netdb.h>
96 Definition of _PATH_SERVICES
97
99 listen(2), endservent(3), getservbyname(3), getservbyport(3), getser‐
100 vent(3), setservent(3), inetd.conf(5), protocols(5), inetd(8)
101
102 Assigned Numbers RFC, most recently RFC 1700, (AKA STD0002)
103
105 This page is part of release 3.22 of the Linux man-pages project. A
106 description of the project, and information about reporting bugs, can
107 be found at http://www.kernel.org/doc/man-pages/.
108
109
110
111Linux 2008-09-23 SERVICES(5)