5

I couldn't find anything much about this, but I'm interested what are pros and cons (if any) in using /etc/services for in-house software?

On my Linux distro (Ubuntu 14.04) at the end of /etc/services is a comment:

# Local services

hinting that it could be a good thing to do.

One thing that comes to mind is that having in-house ports in /etc/services would make serv database a reference point for common knowledge and much better source of default ports for applications throughout the system.

2
  • 2
    I don't see how it could hurt. You'll just need to ensure that 1) You can deploy changes to this file via some sort of configuration management system (this file gets over-written periodically by package updates) and 2) handle conflict resolution for the circumstances when one of your "internal" ports gets assigned to another service.
    – EEAA
    Aug 19, 2014 at 3:09
  • I'm CM newbie, so I needed to check the scheme here first, before proceeding in production. For example, I didn't know /etc/services gets over-written. Since I'm using SaltStack, it won't be a problem. Thnx for hints! Aug 19, 2014 at 22:13

1 Answer 1

7

This is accepted use of the database, and the reason you see that line in the file. Adding entries after that line allows you to quickly identify local additions. It is common for the /etc/services database to be incomplete, so you may be adding some registered ports. Some tools will accept ports by name if they are available from /etc/services, or an equivalent source.

The one risk you have is loosing the additions when patching the O/S as /etc/services may be updated. Make sure you have a copy of the local services that you can quickly append to the new file. Consider automating the addition of missing entries to the file.

If you assign ports for services like NFS and VNC, this is a good location to record those ports. VNC has defined port ranges NFS plays better with firewalls, if you configure it to use fixed ports.

When possible, I would recommend using the IANA registered service ports, even if they aren't listed in the supplied /etc/services file. This can prevent future issues if they get added to the file.

1
  • Great hints. I checked IANA already, and it's HYOOOOOGE. Ubuntu keeps really tiny list compared to IANA, so there shouldn't be any collisions, but I'll keep my eye on those updates. Aug 19, 2014 at 22:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .