/etc/services: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * Linux =Overview=")
 
Line 4: Line 4:


=Overview=
=Overview=
<code>/etc/services</code> is called the "services file" and it stores the mapping between a conventional name and standard port numbers allocated to services and the associated protocol (UDP or TCP). It can optionally store aliases and comments.
The idea behind storing the name - port number mapping in a file is that programs (services) can do a <code>getportbyname()</code> socket call and get the port number they should use. For example, PostgreSQL does a <code>getportbyname ("postgres")</code> and gets 5432/tcp. If the service always uses getportbyname(), then no matter what service is run, the port number can be always reconfigured by editing /etc/services.
=Syntax=
name port/protocol aliases comments

Revision as of 19:41, 18 November 2019

Internal

Overview

/etc/services is called the "services file" and it stores the mapping between a conventional name and standard port numbers allocated to services and the associated protocol (UDP or TCP). It can optionally store aliases and comments.

The idea behind storing the name - port number mapping in a file is that programs (services) can do a getportbyname() socket call and get the port number they should use. For example, PostgreSQL does a getportbyname ("postgres") and gets 5432/tcp. If the service always uses getportbyname(), then no matter what service is run, the port number can be always reconfigured by editing /etc/services.

Syntax

name port/protocol aliases comments