]>
Commit | Line | Data |
---|---|---|
fea681da | 1 | .\" This manpage is Copyright (C) 1996 Austin Donnelly <and1000@cam.ac.uk>, |
bf5a7247 MK |
2 | .\" with additional material Copyright (c) 1995 Martin Schulze |
3 | .\" <joey@infodrom.north.de> | |
fea681da | 4 | .\" |
93015253 | 5 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
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. | |
c13182ef | 14 | .\" |
fea681da MK |
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. | |
c13182ef | 22 | .\" |
fea681da MK |
23 | .\" Formatted or processed versions of this manual, if unaccompanied by |
24 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 25 | .\" %%%LICENSE_END |
fea681da MK |
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 | .\" | |
904ef063 | 34 | .TH SERVICES 5 2010-05-22 "Linux" "Linux Programmer's Manual" |
fea681da MK |
35 | .SH NAME |
36 | services \- Internet network services list | |
37 | .SH DESCRIPTION | |
38 | .B services | |
837f7a82 | 39 | is a plain ASCII file providing a mapping between human-friendly textual |
fea681da | 40 | names for internet services, and their underlying assigned port |
c13182ef MK |
41 | numbers and protocol types. |
42 | Every networking program should look into | |
fea681da MK |
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), | |
c13182ef | 49 | and |
fea681da MK |
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 | |
c13182ef MK |
55 | protocols when assigning a port number. |
56 | Therefore, most entries will | |
837f7a82 | 57 | have two entries, even for TCP-only services. |
fea681da | 58 | |
33a0ccb2 MK |
59 | Port numbers below 1024 (so-called "low numbered" ports) can be |
60 | bound to only by root (see | |
fea681da MK |
61 | .BR bind (2), |
62 | .BR tcp (7), | |
c13182ef | 63 | and |
fea681da MK |
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, | |
c13182ef MK |
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. | |
fea681da | 70 | |
c13182ef | 71 | The presence of an entry for a service in the |
fea681da MK |
72 | .B services |
73 | file does not necessarily mean that the service is currently running | |
c13182ef MK |
74 | on the machine. |
75 | See | |
fea681da | 76 | .BR inetd.conf (5) |
c13182ef MK |
77 | for the configuration of Internet services offered. |
78 | Note that not all | |
fea681da MK |
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 | |
3ebdc868 | 91 | .IR <netdb.h> "." |
fea681da MK |
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 | |
c13182ef MK |
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 | |
fea681da MK |
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 | |
c13182ef MK |
111 | is the type of protocol to be used. |
112 | This field should match an entry | |
fea681da MK |
113 | in the |
114 | .BR protocols (5) | |
c13182ef MK |
115 | file. |
116 | Typical values include | |
fea681da MK |
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 | |
904ef063 | 123 | service. |
c13182ef | 124 | Again, the names are case |
fea681da MK |
125 | sensitive. |
126 | .PP | |
fea681da MK |
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 | |
c13182ef MK |
130 | of the line. |
131 | Blank lines are skipped. | |
fea681da MK |
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 | |
c13182ef MK |
138 | can be any printable characters excluding space and tab. |
139 | However, a conservative choice of characters should be used to minimize | |
b7837a9b | 140 | compatibility problems. |
59dc509c | 141 | For example, a\-z, 0\-9, and hyphen (\-) would seem a |
fea681da MK |
142 | sensible choice. |
143 | ||
144 | Lines not matching this format should not be present in the | |
c13182ef MK |
145 | file. |
146 | (Currently, they are silently skipped by | |
fea681da MK |
147 | .BR getservent (3), |
148 | .BR getservbyname (3), | |
149 | and | |
150 | .BR getservbyport (3). | |
d9bfdb9c | 151 | However, this behavior should not be relied on.) |
fea681da | 152 | |
c3ea9f2d MK |
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. | |
5fab2e7c | 155 | .\" As a backward compatibility feature, the slash (/) between the |
c3ea9f2d MK |
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. | |
71c48553 | 162 | .\" |
fea681da MK |
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 | |
afa64925 | 170 | .ft CW |
fea681da MK |
171 | .nf |
172 | .sp | |
fea681da MK |
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 | |
2bc2f479 | 180 | # 22 \- unassigned |
fea681da | 181 | telnet 23/tcp |
fea681da | 182 | .fi |
afa64925 | 183 | .ft |
fea681da | 184 | .RE |
2b2581ee MK |
185 | .SH FILES |
186 | .TP | |
187 | .I /etc/services | |
188 | The Internet network services list | |
189 | .TP | |
3ebdc868 | 190 | .I <netdb.h> |
2b2581ee MK |
191 | Definition of |
192 | .B _PATH_SERVICES | |
a2610398 MK |
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. | |
71c48553 | 199 | .\" |
a2610398 MK |
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. | |
47297adb | 210 | .SH SEE ALSO |
fea681da MK |
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 | ||
173fe7e7 | 221 | Assigned Numbers RFC, most recently RFC\ 1700, (AKA STD0002). |