OSDN Git Service

LDP: Update original to LDP v3.68
[linuxjm/LDP_man-pages.git] / original / man5 / services.5
1 .\" This manpage is Copyright (C) 1996 Austin Donnelly <and1000@cam.ac.uk>,
2 .\" with additional material Copyright (c) 1995 Martin Schulze
3 .\"     <joey@infodrom.north.de>
4 .\"
5 .\" %%%LICENSE_START(VERBATIM)
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 .\" %%%LICENSE_END
26 .\"
27 .\"   This manpage was made by merging two independently written manpages,
28 .\"   one written by Martin Schulze (18 Oct 95), the other written by
29 .\"   Austin Donnelly, (9 Jan 96).
30 .\"
31 .\" Thu Jan 11 12:14:41 1996 Austin Donnelly  <and1000@cam.ac.uk>
32 .\"   * Merged two services(5) manpages
33 .\"
34 .TH SERVICES 5 2010-05-22 "Linux" "Linux Programmer's Manual"
35 .SH NAME
36 services \- Internet network services list
37 .SH DESCRIPTION
38 .B services
39 is a plain ASCII file providing a mapping between human-friendly textual
40 names for internet services, and their underlying assigned port
41 numbers and protocol types.
42 Every networking program should look into
43 this file to get the port number (and protocol) for its service.
44 The C library routines
45 .BR getservent (3),
46 .BR getservbyname (3),
47 .BR getservbyport (3),
48 .BR setservent (3),
49 and
50 .BR endservent (3)
51 support querying this file from programs.
52
53 Port numbers are assigned by the IANA (Internet Assigned Numbers
54 Authority), and their current policy is to assign both TCP and UDP
55 protocols when assigning a port number.
56 Therefore, most entries will
57 have two entries, even for TCP-only services.
58
59 Port numbers below 1024 (so-called "low numbered" ports) can be
60 bound to only by root (see
61 .BR bind (2),
62 .BR tcp (7),
63 and
64 .BR udp (7)).
65 This is so clients connecting to low numbered ports can trust
66 that the service running on the port is the standard implementation,
67 and not a rogue service run by a user of the machine.
68 Well-known port numbers specified by the IANA are normally
69 located in this root-only space.
70
71 The presence of an entry for a service in the
72 .B services
73 file does not necessarily mean that the service is currently running
74 on the machine.
75 See
76 .BR inetd.conf (5)
77 for the configuration of Internet services offered.
78 Note that not all
79 networking services are started by
80 .BR inetd (8),
81 and so won't appear in
82 .BR inetd.conf (5).
83 In particular, news (NNTP) and mail (SMTP) servers are often
84 initialized from the system boot scripts.
85
86 The location of the
87 .B services
88 file is defined by
89 .B _PATH_SERVICES
90 in
91 .IR <netdb.h> "."
92 This is usually set to
93 .IR /etc/services "."
94
95 Each line describes one service, and is of the form:
96 .IP
97 \f2service-name\ \ \ port\f3/\f2protocol\ \ \ \f1[\f2aliases ...\f1]
98 .TP
99 where:
100 .TP 10
101 .I service-name
102 is the friendly name the service is known by and looked up under.
103 It is case sensitive.
104 Often, the client program is named after the
105 .IR service-name "."
106 .TP
107 .I port
108 is the port number (in decimal) to use for this service.
109 .TP
110 .I protocol
111 is the type of protocol to be used.
112 This field should match an entry
113 in the
114 .BR protocols (5)
115 file.
116 Typical values include
117 .B tcp
118 and
119 .BR udp .
120 .TP
121 .I aliases
122 is an optional space or tab separated list of other names for this
123 service.
124 Again, the names are case
125 sensitive.
126 .PP
127 Either spaces or tabs may be used to separate the fields.
128
129 Comments are started by the hash sign (#) and continue until the end
130 of the line.
131 Blank lines are skipped.
132
133 The
134 .I service-name
135 should begin in the first column of the file, since leading spaces are
136 not stripped.
137 .I service-names
138 can be any printable characters excluding space and tab.
139 However, a conservative choice of characters should be used to minimize
140 compatibility problems.
141 For example, a\-z, 0\-9, and hyphen (\-) would seem a
142 sensible choice.
143
144 Lines not matching this format should not be present in the
145 file.
146 (Currently, they are silently skipped by
147 .BR getservent (3),
148 .BR getservbyname (3),
149 and
150 .BR getservbyport (3).
151 However, this behavior should not be relied on.)
152
153 .\" The following is not true as at glibc 2.8 (a line with a comma is
154 .\" ignored by getservent()); it's not clear if/when it was ever true.
155 .\"   As a backward compatibility feature, the slash (/) between the
156 .\"   .I port
157 .\"   number and
158 .\"   .I protocol
159 .\"   name can in fact be either a slash or a comma (,).
160 .\"   Use of the comma in
161 .\"   modern installations is deprecated.
162 .\"
163 This file might be distributed over a network using a network-wide
164 naming service like Yellow Pages/NIS or BIND/Hesiod.
165
166 A sample
167 .B services
168 file might look like this:
169 .RS
170 .ft CW
171 .nf
172 .sp
173 netstat         15/tcp
174 qotd            17/tcp          quote
175 msp             18/tcp          # message send protocol
176 msp             18/udp          # message send protocol
177 chargen         19/tcp          ttytst source
178 chargen         19/udp          ttytst source
179 ftp             21/tcp
180 # 22 \- unassigned
181 telnet          23/tcp
182 .fi
183 .ft
184 .RE
185 .SH FILES
186 .TP
187 .I /etc/services
188 The Internet network services list
189 .TP
190 .I <netdb.h>
191 Definition of
192 .B _PATH_SERVICES
193 .\" .SH BUGS
194 .\" It's not clear when/if the following was ever true;
195 .\" it isn't true for glibc 2.8:
196 .\"    There is a maximum of 35 aliases, due to the way the
197 .\"    .BR getservent (3)
198 .\"    code is written.
199 .\"
200 .\" It's not clear when/if the following was ever true;
201 .\" it isn't true for glibc 2.8:
202 .\"    Lines longer than
203 .\"    .B BUFSIZ
204 .\"    (currently 1024) characters will be ignored by
205 .\"    .BR getservent (3),
206 .\"    .BR getservbyname (3),
207 .\"    and
208 .\"    .BR getservbyport (3).
209 .\"    However, this will also cause the next line to be mis-parsed.
210 .SH SEE ALSO
211 .BR listen (2),
212 .BR endservent (3),
213 .BR getservbyname (3),
214 .BR getservbyport (3),
215 .BR getservent (3),
216 .BR setservent (3),
217 .BR inetd.conf (5),
218 .BR protocols (5),
219 .BR inetd (8)
220
221 Assigned Numbers RFC, most recently RFC\ 1700, (AKA STD0002).
222 .SH COLOPHON
223 This page is part of release 3.68 of the Linux
224 .I man-pages
225 project.
226 A description of the project,
227 information about reporting bugs,
228 and the latest version of this page,
229 can be found at
230 \%http://www.kernel.org/doc/man\-pages/.