HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
cancel
Showing results for 
Search instead for 
Did you mean: 

/etc/services

 
arun khatwani
Frequent Advisor

/etc/services

Wat is /etc/services and wat are the port numbers defined in it respectively for each service.
9 REPLIES
Avinash20
Honored Contributor

Re: /etc/services

The file /etc/services associates official service names and aliases
with the port number and protocol the services use. For each service
a single line should be present with the following information:



Port numbers 0 through 1023 are assigned by RFC 1700. This RFC also
lists the conventional use of various ports with numbers greater than
1023.

Aliases are other names under which a service is known. Library
routines such as getservbyname() can be invoked with a service alias
instead of the service official name. For example:

shell 514/tcp cmd

Refer to

# man services
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
Pete Randall
Outstanding Contributor

Re: /etc/services

"man 4 services":

DESCRIPTION
The file /etc/services associates official service names and aliases with the port number and protocol the services use.


Pete

Pete
Avinash20
Honored Contributor

Re: /etc/services

Also for Port and Port Range Use

http://docs.hp.com/en/5990-7252/ch01s01.html

Please dont forget to assign points
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
Johnson Punniyalingam
Honored Contributor

Re: /etc/services

The services file contains information regarding the known services
available in the DARPA Internet. For each service a single line should
be present with the following information:

official service name
port number
protocol name
aliases

Items are separated by any number of blanks and/or tab characters. The
port number and protocol name are considered a single item; a ``/'' is
used to separate the port and protocol (e.g. ``512/tcp''). A ``#'' indi-
cates the beginning of a comment; subsequent characters up to the end of
the line are not interpreted by the routines which search the file.

Service names may contain any printable character other than a field
delimiter, newline, or comment character.


Thanks,
Johnson
Problems are common to all, but attitude makes the difference
Torsten.
Acclaimed Contributor

Re: /etc/services

Do you know the inetd?

inetd (the internet super server) is listening on "a lot of" ports. Once a request receives on such a port, inetd will look it up in /etc/services and now it knows - port 23 must be telnet. Now it is searching for telnet in inetd.conf and starts the requested daemon, e.g. telnetd. This is the very short explain ...

See also

http://en.wikipedia.org/wiki/Inetd

and

http://docs.hp.com/en/B3921-60631/services.4.html

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Suraj K Sankari
Honored Contributor

Re: /etc/services

Hi,
This file content all services according to there port no.

see the below example
1st field is serverce and 2nd is port no.

ftp 21/tcp # File Transfer Protocol (Control)
telnet 23/tcp # Virtual Terminal Protocol
smtp 25/tcp # Simple Mail Transfer Protocol


Suraj
Shailendran V Naidu
Frequent Advisor

Re: /etc/services

The port numbers on which certain standard services are offered are defined in the RFC 1700 Assigned Numbers. The /etc/services file enables server and client programs to convert service names to these numbers -ports. The list is kept on each host and it is stored in the file /etc/services. Only the "root" user is allowed to make modification in this file and it is rare to edit the /etc/services file to make change since it already contains the more common service names to port numbers.

inetd, called also the super server, will load a network program based upon a request from the network. The inetd.conf file tells inetd which ports to listen to and what server to start for each port.


Johnson Punniyalingam
Honored Contributor

Re: /etc/services

The port numbers on which certain standard services are offered are defined in the RFC 1700 Assigned Numbers. The /etc/services file enables server and client programs to convert service names to these numbers -ports. The list is kept on each host and it is stored in the file /etc/services. Only the "root" user is allowed to make modification in this file and it is rare to edit the /etc/services file to make change since it already contains the more common service names to port numbers. To improve security, we can immunize this file to prevent unauthorized deletion or addition of services.
Problems are common to all, but attitude makes the difference
Johnson Punniyalingam
Honored Contributor

Re: /etc/services

Hi Arun,

Definition: /etc/services: On UNIX, the configuration file /etc/services maps port numbers to named services. Key point: Its role in life is so that programs can do a getportbyname() sockets call in their code in order to get what port they should use. For example, a POP3 email daemon would do a getportbyname ("pop3") in order to retrieve the number 110 that pop3 runs at. The idea is that if all POP3 daemons use getportbyname(), then no matter what POP3 daemon you run, you can always reconfigure its port number by editing / etc/services. Misunderstanding: This file is bad in order to figure out what port numbers mean. If you want to find out what ports programs are using, you should instead use the program lsof to find out exactly which ports are bound to which processes. If running lsof is not appropriate, then you should lookup the ports in a more generic reference.


Thanks,
JOhnson
Problems are common to all, but attitude makes the difference