Complexity Level: Beginner
This quick and really easy tutorial will stop all logins through your SSH Damon by the root user and change the SSH port for security. There are some of the first things you should be doing when you setup a new server.
Hackers try to brute force the Root account and gain full access to the server, so it is also recommended to switch from port 22 to a non-standard port to make it a little more difficult for the Hacker.
Rather than user the root account when you login into your server through SSH, you should use a normal user login and “Sudo” or “su” to elevate to ‘super user’. This allows you to perform tasks that require root permissions.
At the command prompt:#nano /etc/ssh/sshd_config
and change the line
Then you will want to change the port from 22 to some other unused port, such as 2130 for example.
In the same file that you opened above, look for this line:
# What ports, IPs and protocols we listen forPort 22
and change to:
# What ports, IPs and protocols we listen forPort XXXX
where port XXXX is a 4 digit number for an unused port.