• Zur Hauptnavigation springen
  • Skip to main content
  • Zur Hauptsidebar springen
  • Zur Fußzeile springen
Logo

CITROWEB Webdesign

Erste Wahl für Ihren Onlineauftritt

  • Home
  • Leistungen
    • Webdesign, Webentwicklung und Beratung
    • Online-Shops mit WooCommerce
    • Technische Unterstützung für WooCommerce-Shops
    • Suchmaschinenmarketing
      • SEO: Ihr Webauftritt erhält mehr relevante Besucher
      • SEA: Suchmaschinenwerbung für Ihren Webauftritt
    • Webhosting
  • Blog
  • Kontakt aufnehmen
Home » Blog » How To Disable Root Login on Ubuntu 22.04

How To Disable Root Login on Ubuntu 22.04

10. September 2022

On every Linux system, the user „root“ is created as the first user by default. The root user has the highest privileges and has full access to all commands and files with unlimited read, write and execute permissions. It is important to note that improper or inappropriate use of this user account can have a significant impact on your server.

In this tutorial, you will learn how to disable root login on an Ubuntu system to prevent unauthorized root access via SSH and improve the security of your Linux system.

Disable root login

sudo nano /etc/ssh/sshd_config
...
#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
...

Change the value of the PermitRootLogin setting from yes to no:

...
#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
...

Save and close the file.

Use the following command to restart the SSH service and apply the settings:

sudo systemctl restart sshd

This command restarts the sshd service with systemctl.

In this step, we changed the configuration file to deny root logins, restarted the sshd service to apply the configuration. Next, test whether root login is disabled or not by trying to log in to your server as root.

Test root login

After you disable root login, try to log in as root in a new terminal session using SSH. Use the following commands depending on your preferred login mechanism.

If you use the password-based login:

ssh root@server_ip

The attempt to SSH as root will fail with an error message like this:

root@server_ip: Permission denied (publickey).

Kategorie: Linux, Ubuntu

Haupt-Sidebar

  • How to remove dashicons in WordPress frontend?
  • How do I create a website (homepage) with ChatGPT?
  • Can I create a website (homepage) with ChatGPT?
  • iOS restrictions re: bringing up the keyboard on programmatic focus
  • iOS restrictions re: bringing up the keyboard on programmatic focus
  • Remove user listing from WP-JSON
  • Benutzerauflistung aus WP-JSON entfernen
  • What does „Video is not the main content of the page“ mean?
  • Was hat es mit „Das Video ist nicht der Hauptinhalt der Seite“ auf sich?
  • Remove WordPress logo from toolbar
  • Efficient onboarding simplified: LearnSuite – the cloud application for digital onboarding
  • Wir stellen vor: LearnSuite – Die Cloudanwendung für digitales Onboarding
  • Howto: How do I create a website (homepage) with ChatGPT?
  • Howto: Wie erstelle ich mit ChatGPT eine Website (Homepage)?
  • Can I create a website (homepage) with ChatGPT?
  • Kann ich mit ChatGPT eine Website (Homepage) erstellen?
  • Set noindex nofollow via .htaccess HTTP header
  • Über .htaccess X-Robots-Tag noindex nofollow setzen
  • How to remove WordPress Dashicons in frontend?
  • Wie lassen sich Dashicons im WordPress-Frontend entfernen?
  • DSGVO (3)
  • GDPR (3)
  • Genesis Framework (10)
  • Genesis-Framework (9)
  • Google Search Console (4)
  • Google Search Console (4)
  • Linux (3)
  • Linux (3)
  • mobile (3)
  • Mobile (3)
  • Network (1)
  • Netzwerk (1)
  • SEO (5)
  • SEO (5)
  • Trends (3)
  • Trends (4)
  • Uncategorized (3)
  • Web development (1)
  • Web hosting (1)
  • Webentwicklung (1)
  • Webhosting (1)
  • WooCommerce (9)
  • WooCommerce (9)
  • WordPress (23)
  • WordPress (24)

Footer

Logo




© 2026 CITROWEB
  • Datenschutz
  • Impressum