Use non-standard port for ssh logins

I’d like to use a non-standard port for ssh logins. When I change /etc/sshd_config so that Port nn is my new port I cannot even restart ssh.

I’ve been around Linux for some time but I have not had occasion to use either the firewall or selinux. So please don’t suggest I change either of these because frankly I don’t know how. I require details.

Here is an article from google on how to set a different port:

It also tells you how to set selinux to use that new port. That is most likely the reason why it failed to restart after being changed. Steps 3 and 4 address selinux and the firewall. Steps 2 and 5 address changing the ssh config and restarting it.

Indeed. Process starts. Tries to listen on port. SELinux says: “no”. Process could run without listening that port, or die. Sshd does die.

@dmfwi If you do have Rocky 9, then do not edit /etc/ssh/sshd_config – add a new *.conf file into /etc/ssh/sshd_config.d/ and you choices in it.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.