Define service names and port in Linux Server


The /etc/services file is enables the server and client programs to convert the service names in to these numbers  ports. The list is kept on each host and it is always  stored in the same file /etc/services. As per default configuration  the “root” user is only allowed to make the modification in this /etc/services.  To improve the server security, we can  immunize this file to prevent unauthorized deletion or addition of services. If you wan to add any new service on the server with the respective port then refer to the following syntax and add the new service with the respective port but make sure that new port is not used by any other existing service else it will cause the problem to start the service because we can’t define same port for two different services.

new-service-name  new-service-name-port-no/tcp # Description
new-service-name  new-service-name-port-no/udp # Description 

For example if we want to add the new port for SMTP than add the following lines in the /etc/services file.

smtp 26/tcp mail # SMTP
smtp 26/udp mail # SMTP

About Anant 384 Articles
Senior technical writer