Disabling the default SSH port and direct root user login on the Linux machine

Many times, a hacker tries to login directly via root access on the Linux machine (which enables root login) and can get access by cracking the password with the default SSH port.

Today we'll discuss how to change the default SSH port and to disable direct root login on the remote Linux machine via SSH. This is all done with the help of SSH (Secure Shell).

Follow the steps below:-

Step 1: Login onto the Linux machine.
Step 2: Open the SSHD configuration file at the location below:-

vim /etc/ssh/sshd_config

Step 3: Find the commented settings below and do the changes as below:-

#Port 22

Port 9899

#PermitRootLogin yes

PermitRootLogin no

Step 4: Save the file and restart the SSHD service using the command below:-

service sshd restart

and that's it. You've secured your Linux machine/server by using SSH on its default port and with the root user.

After this, make sure you've created another normal user account with which you can use SSH on the Linux machine and after that take shell of the root using the su - command and with the root password.

This will make your system more secure.

Sachin Saturday 22 February 2014 - 06:31 am | | Default

No comments

(optional field)
(optional field)

Comment moderation is enabled on this site. This means that your comment will not be visible until it has been approved by an editor.

Remember personal info?
Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.