Moving SSH off port 22 cuts bot noise. Do it carefully: open the new port in the firewall before you close the old one.
Steps
Edit the sshd configuration:
sudo nano /etc/ssh/sshd_configSet (or uncomment) a Port line with your chosen port, e.g. 2222. Save the file.
Port 2222Open the new port in the firewall (UFW example) and allow traffic:
sudo ufw allow 2222/tcpsudo ufw statusValidate the config and reload sshd:
sudo sshd -tsudo systemctl reload sshIn another terminal, test the new port before closing your current session:
ssh -p 2222 user@YOUR_IP
Tips
- Do not close the old session until the new-port login works.
- Update Fail2Ban/iptables/UFW and your SSH client Host config.
ext step
eed a dedicated IP ready to harden SSH? Deploy on Xernode.