Non standard ssh port: should I edit /etc/services?
I don't think it makes sense to edit /etc/services
in such a case. The world will not change ssh ports with you, and all programs that look up service names to port numbers on your machine would get the incorrect port for ssh.
If anything, it might make more sense to add an entry of your own for your non-standard ssh port, eg myssh <yourport>/tcp
if you want a service name that you can use.
Then there's obviously the age-long debate of whether changing ports like that to "hide" services actually serves any real purpose beyond reducing log spam.
The file /etc/services
contains the IANA assigned port numbers and there is not a single technical requirement to modify that file to be able to you run your services on a non-standard port. When you want a non-default port typically you can numerically set that port number in a service configuration file or with a start-up option.
I would also find it hard to diagnose why a service is not listening on its default port, when the non-standard port is not explicitly set in the start-up script or server configuration file, but taken from a modified /etc/services
.
If you did change /etc/services
to reflect your non-standard port number, please don't use an established service name such as ssh
on your custom port as that might break connectivity when connecting to other system from yours.
You'll be hard-pressed to diagnose why ssh otherhost
suddenly fails to connect when on that otherhost TCP/IP port 22 is open...
.