How to update SSH Port on Ubuntu

- Words
2024-12-02

Context: Default SSH port 22 gaining too much traffic from automated attempts.

One way to reduce brute force attempts on an SSH server is to change the default port. Strangely, my Ubuntu 2024 server is unable to follow most online tutorials as it does not have sshd.service to restart.

To get around this, instead, I still edit the config file and set the port to it's custom value.

sudo nano /etc/ssh/sshd_config

Edit the Port line to the new, updated port value.

Port 22

Now restart your SSH service.

For most tutorials, they provide the following line.

sudo systemctl restart sshd

If the above does not work, try this instead.

sudo systemctl daemon-reload
sudo systemctl restart ssh

 

Source: https://askubuntu.com/questions/1483893/unable-to-change-ssh-port-on-ubuntu


Jozef
Author