Jul 11, 2024 1 min read

Disable SSH root login in Linux (OpenSSH)

Disable SSH root login in Linux (OpenSSH)
Photo by Jake Walker / Unsplash

SSH is commonly used to access and configure remote Linux servers. OpenSSH is a very widely used tool to make SSH connections. On many Linux distributions, root access is disabled by default. However, root access may be enabled on some systems you encounter (especially on the cloud). If it is enabled, it's important to disable it ASAP, as it is a security risk.

Check out the video below to learn how to disable the root login on a Linux system using OpenSSH.

Here's how to do it:

  1. On the OpenSSH system edit /etc/ssh/sshd_config
  2. Find the line that says PermitRootLogin and set it to no.
  3. Save the configuration.
  4. Restart the OpenSSH server: systemctl restart sshd
  5. Root access should now be denied.

VIDEO

📽️
Check out the Linux Security - Basics & Beyond video course: available on O'Reilly and InformIT. (For InformIT, use the code PROWSE70 at checkout to receive a 70% discount.)


Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Prowse Tech.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.