Disable Root SSH Login For Linux

English

Disable root ssh login for Linux.

It's not smart to allow root users to log in via SSH. It's no secret that every Linux system has a user named root.

Your server is and will always be vulnerable to brute force attacks if root can log in via SSH.

Disable root ssh login for Linux.

Instead, you should create another user who is able to SSH login and disable root SSH login. With this solution, the hacker must calculate both the username and password.

Create a new user:

useradd kalleanka

passwd kalleanka

Make sure your new user can log in via SSH and can use the su command to switch to the root user.

Then edit the SSH configuration file.

nano /etc/ssh/sshd_config

Or:

gedit /etc/ssh/sshd_config

Search for:

#PermitRootLogin yes

Change to: NO

Add the following line at the end of this file. This line ensures that the new user can log in via SSH.

AllowUsers kalleanka

Save and close. Restart the SSH service, using the following command:

systemctl restart sshd

Från och med nu kan endast den nya användaren logga in via SSH och därefter kan den här användaren byta till root med hjälp av su-kommandot. Om en hacker försöker logga in som en användare med SSH inaktiverad (som root), ser du följande rad i din SSH logg.

Failed password for invalid user root

Games For Linux

Windows has always been the preferred platform for gaming, but after STEAM's interest in Linux more game developers are making their games natively available for Linux.

Disclaimer

All information on this website is published in good faith and for general educational purposes and for use in safe testing environments only. While linuxexperten.com strives to make the information on this site as accurate as possible, linuxexperten.com does not warrant its completeness, reliability and accuracy.

We are not responsible for any losses or damages associated with the use of our website. While we strive to provide only links to useful websites, we have no control over the content of these sites and links to other sites do not constitute a recommendation for all content contained on these websites.

 

Site Information

This is a professional review site that receives compensation from the companies whose products reviewed. Each service or product are thoroughly tested and given high marks if considered to be the very best. Independently owned and the opinions expressed here are no one elses.

 

Limited Time Offers

Coming soon...