- Remember the ssh port you’ve chosen, otherwise you’ll no longer be able to connect!
- If using a firewall be sure to open/forward the newly set ssh port! Otherwise you’ll also be locked out!
Change the ssh listen port from default (22/TCP) to something random
Open /etc/ssh/sshd_config and change:
to your custom port, e.g. 42815:
Save and restart sshd.
Combine this with forced key based ssh auth and youre ssh setup will be a bit more secure!