Blame man5/services.5

Packit 7cfc04
.\" This manpage is Copyright (C) 1996 Austin Donnelly <and1000@cam.ac.uk>,
Packit 7cfc04
.\" with additional material Copyright (c) 1995 Martin Schulze
Packit 7cfc04
.\"     <joey@infodrom.north.de>
Packit 7cfc04
.\"
Packit 7cfc04
.\" %%%LICENSE_START(VERBATIM)
Packit 7cfc04
.\" Permission is granted to make and distribute verbatim copies of this
Packit 7cfc04
.\" manual provided the copyright notice and this permission notice are
Packit 7cfc04
.\" preserved on all copies.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Permission is granted to copy and distribute modified versions of this
Packit 7cfc04
.\" manual under the conditions for verbatim copying, provided that the
Packit 7cfc04
.\" entire resulting derived work is distributed under the terms of a
Packit 7cfc04
.\" permission notice identical to this one.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Since the Linux kernel and libraries are constantly changing, this
Packit 7cfc04
.\" manual page may be incorrect or out-of-date.  The author(s) assume no
Packit 7cfc04
.\" responsibility for errors or omissions, or for damages resulting from
Packit 7cfc04
.\" the use of the information contained herein.  The author(s) may not
Packit 7cfc04
.\" have taken the same level of care in the production of this manual,
Packit 7cfc04
.\" which is licensed free of charge, as they might when working
Packit 7cfc04
.\" professionally.
Packit 7cfc04
.\"
Packit 7cfc04
.\" Formatted or processed versions of this manual, if unaccompanied by
Packit 7cfc04
.\" the source, must acknowledge the copyright and authors of this work.
Packit 7cfc04
.\" %%%LICENSE_END
Packit 7cfc04
.\"
Packit 7cfc04
.\"   This manpage was made by merging two independently written manpages,
Packit 7cfc04
.\"   one written by Martin Schulze (18 Oct 95), the other written by
Packit 7cfc04
.\"   Austin Donnelly, (9 Jan 96).
Packit 7cfc04
.\"
Packit 7cfc04
.\" Thu Jan 11 12:14:41 1996 Austin Donnelly  <and1000@cam.ac.uk>
Packit 7cfc04
.\"   * Merged two services(5) manpages
Packit 7cfc04
.\"
Packit 7cfc04
.TH SERVICES 5 2010-05-22 "Linux" "Linux Programmer's Manual"
Packit 7cfc04
.SH NAME
Packit 7cfc04
services \- Internet network services list
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
.B services
Packit 7cfc04
is a plain ASCII file providing a mapping between human-friendly textual
Packit 7cfc04
names for internet services, and their underlying assigned port
Packit 7cfc04
numbers and protocol types.
Packit 7cfc04
Every networking program should look into
Packit 7cfc04
this file to get the port number (and protocol) for its service.
Packit 7cfc04
The C library routines
Packit 7cfc04
.BR getservent (3),
Packit 7cfc04
.BR getservbyname (3),
Packit 7cfc04
.BR getservbyport (3),
Packit 7cfc04
.BR setservent (3),
Packit 7cfc04
and
Packit 7cfc04
.BR endservent (3)
Packit 7cfc04
support querying this file from programs.
Packit 7cfc04
.PP
Packit 7cfc04
Port numbers are assigned by the IANA (Internet Assigned Numbers
Packit 7cfc04
Authority), and their current policy is to assign both TCP and UDP
Packit 7cfc04
protocols when assigning a port number.
Packit 7cfc04
Therefore, most entries will
Packit 7cfc04
have two entries, even for TCP-only services.
Packit 7cfc04
.PP
Packit 7cfc04
Port numbers below 1024 (so-called "low numbered" ports) can be
Packit 7cfc04
bound to only by root (see
Packit 7cfc04
.BR bind (2),
Packit 7cfc04
.BR tcp (7),
Packit 7cfc04
and
Packit 7cfc04
.BR udp (7)).
Packit 7cfc04
This is so clients connecting to low numbered ports can trust
Packit 7cfc04
that the service running on the port is the standard implementation,
Packit 7cfc04
and not a rogue service run by a user of the machine.
Packit 7cfc04
Well-known port numbers specified by the IANA are normally
Packit 7cfc04
located in this root-only space.
Packit 7cfc04
.PP
Packit 7cfc04
The presence of an entry for a service in the
Packit 7cfc04
.B services
Packit 7cfc04
file does not necessarily mean that the service is currently running
Packit 7cfc04
on the machine.
Packit 7cfc04
See
Packit 7cfc04
.BR inetd.conf (5)
Packit 7cfc04
for the configuration of Internet services offered.
Packit 7cfc04
Note that not all
Packit 7cfc04
networking services are started by
Packit 7cfc04
.BR inetd (8),
Packit 7cfc04
and so won't appear in
Packit 7cfc04
.BR inetd.conf (5).
Packit 7cfc04
In particular, news (NNTP) and mail (SMTP) servers are often
Packit 7cfc04
initialized from the system boot scripts.
Packit 7cfc04
.PP
Packit 7cfc04
The location of the
Packit 7cfc04
.B services
Packit 7cfc04
file is defined by
Packit 7cfc04
.B _PATH_SERVICES
Packit 7cfc04
in
Packit 7cfc04
.IR <netdb.h> "."
Packit 7cfc04
This is usually set to
Packit 7cfc04
.IR /etc/services "."
Packit 7cfc04
.PP
Packit 7cfc04
Each line describes one service, and is of the form:
Packit 7cfc04
.IP
Packit 7cfc04
\f2service-name\ \ \ port\f3/\f2protocol\ \ \ \f1[\f2aliases ...\f1]
Packit 7cfc04
.TP
Packit 7cfc04
where:
Packit 7cfc04
.TP 10
Packit 7cfc04
.I service-name
Packit 7cfc04
is the friendly name the service is known by and looked up under.
Packit 7cfc04
It is case sensitive.
Packit 7cfc04
Often, the client program is named after the
Packit 7cfc04
.IR service-name "."
Packit 7cfc04
.TP
Packit 7cfc04
.I port
Packit 7cfc04
is the port number (in decimal) to use for this service.
Packit 7cfc04
.TP
Packit 7cfc04
.I protocol
Packit 7cfc04
is the type of protocol to be used.
Packit 7cfc04
This field should match an entry
Packit 7cfc04
in the
Packit 7cfc04
.BR protocols (5)
Packit 7cfc04
file.
Packit 7cfc04
Typical values include
Packit 7cfc04
.B tcp
Packit 7cfc04
and
Packit 7cfc04
.BR udp .
Packit 7cfc04
.TP
Packit 7cfc04
.I aliases
Packit 7cfc04
is an optional space or tab separated list of other names for this
Packit 7cfc04
service.
Packit 7cfc04
Again, the names are case
Packit 7cfc04
sensitive.
Packit 7cfc04
.PP
Packit 7cfc04
Either spaces or tabs may be used to separate the fields.
Packit 7cfc04
.PP
Packit 7cfc04
Comments are started by the hash sign (#) and continue until the end
Packit 7cfc04
of the line.
Packit 7cfc04
Blank lines are skipped.
Packit 7cfc04
.PP
Packit 7cfc04
The
Packit 7cfc04
.I service-name
Packit 7cfc04
should begin in the first column of the file, since leading spaces are
Packit 7cfc04
not stripped.
Packit 7cfc04
.I service-names
Packit 7cfc04
can be any printable characters excluding space and tab.
Packit 7cfc04
However, a conservative choice of characters should be used to minimize
Packit 7cfc04
compatibility problems.
Packit 7cfc04
For example, a\-z, 0\-9, and hyphen (\-) would seem a
Packit 7cfc04
sensible choice.
Packit 7cfc04
.PP
Packit 7cfc04
Lines not matching this format should not be present in the
Packit 7cfc04
file.
Packit 7cfc04
(Currently, they are silently skipped by
Packit 7cfc04
.BR getservent (3),
Packit 7cfc04
.BR getservbyname (3),
Packit 7cfc04
and
Packit 7cfc04
.BR getservbyport (3).
Packit 7cfc04
However, this behavior should not be relied on.)
Packit 7cfc04
.PP
Packit 7cfc04
.\" The following is not true as at glibc 2.8 (a line with a comma is
Packit 7cfc04
.\" ignored by getservent()); it's not clear if/when it was ever true.
Packit 7cfc04
.\"   As a backward compatibility feature, the slash (/) between the
Packit 7cfc04
.\"   .I port
Packit 7cfc04
.\"   number and
Packit 7cfc04
.\"   .I protocol
Packit 7cfc04
.\"   name can in fact be either a slash or a comma (,).
Packit 7cfc04
.\"   Use of the comma in
Packit 7cfc04
.\"   modern installations is deprecated.
Packit 7cfc04
.\"
Packit 7cfc04
This file might be distributed over a network using a network-wide
Packit 7cfc04
naming service like Yellow Pages/NIS or BIND/Hesiod.
Packit 7cfc04
.PP
Packit 7cfc04
A sample
Packit 7cfc04
.B services
Packit 7cfc04
file might look like this:
Packit 7cfc04
.PP
Packit 7cfc04
.in +4n
Packit 7cfc04
.EX
Packit 7cfc04
netstat         15/tcp
Packit 7cfc04
qotd            17/tcp          quote
Packit 7cfc04
msp             18/tcp          # message send protocol
Packit 7cfc04
msp             18/udp          # message send protocol
Packit 7cfc04
chargen         19/tcp          ttytst source
Packit 7cfc04
chargen         19/udp          ttytst source
Packit 7cfc04
ftp             21/tcp
Packit 7cfc04
# 22 \- unassigned
Packit 7cfc04
telnet          23/tcp
Packit 7cfc04
.EE
Packit 7cfc04
.in
Packit 7cfc04
.SH FILES
Packit 7cfc04
.TP
Packit 7cfc04
.I /etc/services
Packit 7cfc04
The Internet network services list
Packit 7cfc04
.TP
Packit 7cfc04
.I <netdb.h>
Packit 7cfc04
Definition of
Packit 7cfc04
.B _PATH_SERVICES
Packit 7cfc04
.\" .SH BUGS
Packit 7cfc04
.\" It's not clear when/if the following was ever true;
Packit 7cfc04
.\" it isn't true for glibc 2.8:
Packit 7cfc04
.\"    There is a maximum of 35 aliases, due to the way the
Packit 7cfc04
.\"    .BR getservent (3)
Packit 7cfc04
.\"    code is written.
Packit 7cfc04
.\"
Packit 7cfc04
.\" It's not clear when/if the following was ever true;
Packit 7cfc04
.\" it isn't true for glibc 2.8:
Packit 7cfc04
.\"    Lines longer than
Packit 7cfc04
.\"    .B BUFSIZ
Packit 7cfc04
.\"    (currently 1024) characters will be ignored by
Packit 7cfc04
.\"    .BR getservent (3),
Packit 7cfc04
.\"    .BR getservbyname (3),
Packit 7cfc04
.\"    and
Packit 7cfc04
.\"    .BR getservbyport (3).
Packit 7cfc04
.\"    However, this will also cause the next line to be mis-parsed.
Packit 7cfc04
.SH SEE ALSO
Packit 7cfc04
.BR listen (2),
Packit 7cfc04
.BR endservent (3),
Packit 7cfc04
.BR getservbyname (3),
Packit 7cfc04
.BR getservbyport (3),
Packit 7cfc04
.BR getservent (3),
Packit 7cfc04
.BR setservent (3),
Packit 7cfc04
.BR inetd.conf (5),
Packit 7cfc04
.BR protocols (5),
Packit 7cfc04
.BR inetd (8)
Packit 7cfc04
.PP
Packit 7cfc04
Assigned Numbers RFC, most recently RFC\ 1700, (AKA STD0002).
Packit 7cfc04
.SH COLOPHON
Packit 7cfc04
This page is part of release 4.15 of the Linux
Packit 7cfc04
.I man-pages
Packit 7cfc04
project.
Packit 7cfc04
A description of the project,
Packit 7cfc04
information about reporting bugs,
Packit 7cfc04
and the latest version of this page,
Packit 7cfc04
can be found at
Packit 7cfc04
\%https://www.kernel.org/doc/man\-pages/.