Jump to content

Featured Replies

Posted

You are reading Part 1 of the 57-part series: Harden and Secure Linux Servers. [Level 1]

This series covers progressive security measures, from fundamental hardening techniques to enterprise-grade defense strategies. Each article delves into a specific security practice, explaining its importance and providing step-by-step guidance for implementation.

To explore more security best practices, visit the main guide for a full breakdown of all levels and recommendations.

The root user has unrestricted access to the entire system, making it a high-value target for attackers. If an attacker gains access to the root account, they can control everything on the server. Disabling direct root login helps prevent brute-force attacks and forces users to log in with a limited-privilege account, reducing security risks.

How to Disable Root Login
  1. Open the SSH configuration file:

    sudo nano /etc/ssh/sshd_config
    
  2. Locate the following line:

    PermitRootLogin yes
    
  3. Change it to:

    PermitRootLogin no
    
  4. Save and close the file.

  5. Restart the SSH service to apply the changes:

    sudo systemctl restart sshd
    
Best Practices:

Use a non-root user with sudo privileges instead of logging in as root.
Combine this with SSH key authentication to further enhance security.
Monitor SSH login attempts using sudo cat /var/log/auth.log | grep "sshd" to check for unauthorized access attempts.

By implementing this step, you make it significantly harder for attackers to gain unauthorized access to your Linux server, improving its overall security.

  • Views 299
  • Created
  • Last Reply

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Important Information

Terms of Use Privacy Policy Guidelines We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.