Everyone knows 22 is the default SSH port. It’s always good to change the default SSH port and set it to something someone can’t even guess, which will save your system from usual hack attempts.
Here I’m going to change the port to 4242. Edit the main SSH configuration file.
You can find the below line.
Change it as below.
Restart SSH to update the changes.
You have changed the SSH port to 4242.
To login as “sshusr” from a remote Linux machine, you can run the below command.
ssh sshusr@IP/Hostname -p 4242
So that’s how you change the default SSH port.