I'd like to assign a friendly name to a port number, how should I do it?
For example: I'd like "0.0.0.0:my-service-name" translates to "0.0.0.0:1234"
I'd like to assign a friendly name to a port number, how should I do it?
For example: I'd like "0.0.0.0:my-service-name" translates to "0.0.0.0:1234"
Yes, you can do this, by adding your port definition to /etc/services
. For a TCP service, you’d add
my-service-name 1234/tcp
Once that’s done, you’ll be able to write “0.0.0.0:my-service-name” instead of “0.0.0.0:1234”.
The canonical list of services is maintained by the IANA, but you can add local definitions; you might even see a “# Local services” comment at the end of your /etc/services
file already.
/etc/services
on those machines. – HiddenWindshield Sep 26 '20 at 22:41/etc/services
is a conffile (see/var/lib/dpkg/info/netbase.conffiles
). More generally,/etc
belongs to the system administrator, it’s a bug if a package doesn’t preserve changes made there. – Stephen Kitt Sep 27 '20 at 08:23