/etc/services

From NovaOrdis Knowledge Base
Revision as of 19:41, 18 November 2019 by Ovidiu (talk | contribs) (→‎Overview)
Jump to navigation Jump to search

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