1834650 Members
2019 Online
110069 Solutions
New Discussion

/etc/services

 
SOLVED
Go to solution
Johan Nielsen
Advisor

/etc/services

What role does /etc/services play in governing inbound and outbound network connections?

If it does have a role, what is the general best practice when utilizing this function?

Thanks in advance...
johan
4 REPLIES 4
TwoProc
Honored Contributor
Solution

Re: /etc/services

No role in governing. It's a way to name services running by the port number they run on. Much like machine names have lookup abilities by their host name in the /etc/hosts file - but it's really just a host name tied to an IP address. So, the name in the host name doesn't really name a host, it assigns a name to an IP address, of which a host may have many.

If you run (among other things) a netstat command, instead of seeing a port number you'd see the service name assigned in /etc/services.

That's all it does.
We are the people our parents warned us about --Jimmy Buffett
Mel Burslan
Honored Contributor

Re: /etc/services

/etc/services file is only for inbound communications.

it is basicaaly a lookup file for the services which are running or authorized to run on any given machine and the ports associated with them

for instance:

telnet 23/tcp

says, whatever comes as a request witbh tcp protocol to my computer's port 23 will be treated as a telnet request and the necessary action to serve such a request will be taken, i.e., an telnetd process will be spawned to service the request.

I am not sure what other information that you are after. If you can elaborate on your question, you may get a more meaningful answer.

Hope this helps a bit
________________________________
UNIX because I majored in cryptology...
Uday_S_Ankolekar
Honored Contributor

Re: /etc/services

In short... refer man pages..
man services
It mainly controls inbound traffic for specific ports and related protocol.


-USA..
Good Luck..
A. Clay Stephenson
Acclaimed Contributor

Re: /etc/services

It's not true that /etc/services is only used for inbound communications. Get servbyname() (the service name to port number mapping functions) works equally well for either and is used by both -- or not used at all by both. It all depends upon how the code was written. Other than leaving the common assignments as they are, there are no rules for the file. If you have custom services then you will need to add them. Often, cutom applications will have no idea what ports are avilable on your server so they will tell you to create an entry for "myservice" and you find an otherwise unused port. The custom programs use the name "myservice" and your /etc/services entry does the name to number translation.

/etc/services really plays no role in security because "well-written" exploits will not bother with name to port mapping and use the port numbers directly.
If it ain't broke, I can fix that.