]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man5/services.5
hyphen/dash fixes
[thirdparty/man-pages.git] / man5 / services.5
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" This manpage is Copyright (C) 1996 Austin Donnelly <and1000@cam.ac.uk>,
4 .\" with additional material (c) 1995 Martin Schulze <joey@infodrom.north.de>
5 .\"
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein. The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\"
26 .\" This manpage was made by merging two independently written manpages,
27 .\" one written by Martin Schulze (18 Oct 95), the other written by
28 .\" Austin Donnelly, (9 Jan 96).
29 .\"
30 .\" Thu Jan 11 12:14:41 1996 Austin Donnelly <and1000@cam.ac.uk>
31 .\" * Merged two services(5) manpages
32 .\"
33 .TH SERVICES 5 1996-01-11 "Linux" "Linux Programmer's Manual"
34 .SH NAME
35 services \- Internet network services list
36 .SH DESCRIPTION
37 .B services
38 is a plain ASCII file providing a mapping between friendly textual
39 names for internet services, and their underlying assigned port
40 numbers and protocol types. Every networking program should look into
41 this file to get the port number (and protocol) for its service.
42 The C library routines
43 .BR getservent (3),
44 .BR getservbyname (3),
45 .BR getservbyport (3),
46 .BR setservent (3),
47 and
48 .BR endservent (3)
49 support querying this file from programs.
50
51 Port numbers are assigned by the IANA (Internet Assigned Numbers
52 Authority), and their current policy is to assign both TCP and UDP
53 protocols when assigning a port number. Therefore, most entries will
54 have two entries, even for TCP only services.
55
56 Port numbers below 1024 (so-called 'low numbered' ports) can only be
57 bound to by root (see
58 .BR bind (2),
59 .BR tcp (7),
60 and
61 .BR udp (7)).
62 This is so clients connecting to low numbered ports can trust
63 that the service running on the port is the standard implementation,
64 and not a rogue service run by a user of the machine. Well-known port
65 numbers specified by the IANA are normally located in this root-only
66 space.
67
68 The presence of an entry for a service in the
69 .B services
70 file does not necessarily mean that the service is currently running
71 on the machine. See
72 .BR inetd.conf (5)
73 for the configuration of Internet services offered. Note that not all
74 networking services are started by
75 .BR inetd (8),
76 and so won't appear in
77 .BR inetd.conf (5).
78 In particular, news (NNTP) and mail (SMTP) servers are often
79 initialized from the system boot scripts.
80
81 The location of the
82 .B services
83 file is defined by
84 .B _PATH_SERVICES
85 in
86 .IR /usr/include/netdb.h "."
87 This is usually set to
88 .IR /etc/services "."
89
90 Each line describes one service, and is of the form:
91 .IP
92 \f2service-name\ \ \ port\f3/\f2protocol\ \ \ \f1[\f2aliases ...\f1]
93 .TP
94 where:
95 .TP 10
96 .I service-name
97 is the friendly name the service is known by and looked up under. It
98 is case sensitive. Often, the client program is named after the
99 .IR service-name "."
100 .TP
101 .I port
102 is the port number (in decimal) to use for this service.
103 .TP
104 .I protocol
105 is the type of protocol to be used. This field should match an entry
106 in the
107 .BR protocols (5)
108 file. Typical values include
109 .B tcp
110 and
111 .BR udp .
112 .TP
113 .I aliases
114 is an optional space or tab separated list of other names for this
115 service (but see the BUGS section below). Again, the names are case
116 sensitive.
117 .PP
118
119 Either spaces or tabs may be used to separate the fields.
120
121 Comments are started by the hash sign (#) and continue until the end
122 of the line. Blank lines are skipped.
123
124 The
125 .I service-name
126 should begin in the first column of the file, since leading spaces are
127 not stripped.
128 .I service-names
129 can be any printable characters excluding space and tab. However,
130 a conservative choice of characters should be used to minimize
131 inter-operability problems. E.g., a\-z, 0\-9, and hyphen (\-) would seem a
132 sensible choice.
133
134 Lines not matching this format should not be present in the
135 file. (Currently, they are silently skipped by
136 .BR getservent (3),
137 .BR getservbyname (3),
138 and
139 .BR getservbyport (3).
140 However, this behaviour should not be relied on.)
141
142 As a backwards compatibility feature, the slash (/) between the
143 .I port
144 number and
145 .I protocol
146 name can in fact be either a slash or a comma (,). Use of the comma in
147 modern installations is depreciated.
148
149 This file might be distributed over a network using a network-wide
150 naming service like Yellow Pages/NIS or BIND/Hesiod.
151
152 A sample
153 .B services
154 file might look like this:
155 .RS
156 .nf
157 .sp
158 .ta 3i
159 netstat 15/tcp
160 qotd 17/tcp quote
161 msp 18/tcp # message send protocol
162 msp 18/udp # message send protocol
163 chargen 19/tcp ttytst source
164 chargen 19/udp ttytst source
165 ftp 21/tcp
166 # 22 \- unassigned
167 telnet 23/tcp
168 .sp
169 .fi
170 .RE
171 .SH BUGS
172 There is a maximum of 35 aliases, due to the way the
173 .BR getservent (3)
174 code is written.
175
176 Lines longer than
177 .B BUFSIZ
178 (currently 1024) characters will be ignored by
179 .BR getservent (3),
180 .BR getservbyname (3),
181 and
182 .BR getservbyport (3).
183 However, this will also cause the next line to be mis-parsed.
184 .SH FILES
185 .TP
186 .I /etc/services
187 The Internet network services list
188 .TP
189 .I /usr/include/netdb.h
190 Definition of
191 .B _PATH_SERVICES
192 .SH "SEE ALSO"
193 .BR listen (2),
194 .BR endservent (3),
195 .BR getservbyname (3),
196 .BR getservbyport (3),
197 .BR getservent (3),
198 .BR setservent (3),
199 .BR inetd.conf (5),
200 .BR protocols (5),
201 .BR inetd (8)
202
203 Assigned Numbers RFC, most recently RFC 1700, (AKA STD0002)
204
205 Guide to Yellow Pages Service
206
207 Guide to BIND/Hesiod Service