Skip to content

Ubuntu Free

  • Current Page Parent Ubuntu Tutorials
  • Ubuntu Apps
  • Ubuntu Gaming
  • AI on Ubuntu
  • Themes
  • Wallpapers
  • News
  • Current Page Parent Ubuntu Tutorials
  • Ubuntu Apps
  • Ubuntu Gaming
  • AI on Ubuntu
  • Themes
  • Wallpapers
  • News

Home » Ubuntu How To » How to Enable or Disable the Root Account on Ubuntu 26.04 – sudo, su & passwd

How to Enable or Disable the Root Account on Ubuntu 26.04 – sudo, su & passwd

Share
  • Post Updated: November 6, 2026
  • Mike Holbrook
3 Min Read · Ubuntu 26.04 LTS · sudo, su and passwd
The Root Account on Ubuntu

To enable the root account on Ubuntu 26.04, run sudo passwd root and set a password. To disable it again, run sudo passwd -l root. If you only need a root shell for a few commands, sudo -i gives you one without enabling root at all.

Below: how to check whether root is enabled, switch to it with su, lock it again, and why root still cannot sign in at the login screen or over SSH. If something here does not match your system, leave a comment or contact us.

Root: locked by default
Root shell: sudo -i
Lock again: passwd -l
SSH as root: key only
Enable root in 3 stepsUse sudo -i instead

On this page

Toggle
  • Enable the Root Account in 3 Steps
  • Disable the Root Account Again
  • Get a Root Shell Without Enabling Root
  • Root Login on the Desktop and Over SSH
  • If Something Goes Wrong
  • Helpful Resources
  • Frequently Asked Questions

Enable the Root Account in 3 Steps

Ubuntu installs with root locked, and your own account does admin work through sudo. Open a terminal with Ctrl + Alt + T.

1

Check whether root is enabled

Show the root account status
sudo passwd -S root
mike@ubuntu:~$ sudo passwd -S root
root L 2026-04-23 0 99999 7 -1

The second field is what matters. L means locked, which is the default. P means root has a usable password. NP means it has no password at all.

2

Give root a password

Enable root by setting its password
sudo passwd root
mike@ubuntu:~$ sudo passwd root
New password:
Retype new password:
passwd: password updated successfully

sudo asks for your own password first. Then type the new root password twice. Nothing shows while you type. Use a different password from your own, and a strong one: it unlocks the whole system.

3

Switch to root

Log in as root
su -
mike@ubuntu:~$ su -
Password:
root@ubuntu:~#

Enter the root password. The prompt ends in # while you are root. Type exit to go back to your own account.

Disable the Root Account Again

Lock the root account
sudo passwd -l root

Check it worked with sudo passwd -S root. The second field should read L again. Locking root does not affect sudo, so your own account keeps its admin rights.

Note
Locking the password does not block SSH keys. If you ever added a key for root, remove the file /root/.ssh/authorized_keys too, or root can still log in with that key.

Get a Root Shell Without Enabling Root

For most jobs you never need to enable root. These all use your own password:

Command What it does
sudo command Runs one command as root
sudo -i Opens a root shell, starting in root’s home folder
sudo -s Opens a root shell and stays in the current folder
exit Leaves the root shell
Open a root shell
sudo -i
mike@ubuntu:~$ sudo -i
root@ubuntu:~# whoami
root

Ubuntu 26.04 uses sudo-rs, a rewrite of sudo, for its sudo command. These options work the same way. More examples are in our sudo command cheat sheet.

Root Login on the Desktop and Over SSH

Giving root a password does not let it sign in everywhere. Ubuntu blocks two routes on purpose.

Desktop

Root cannot sign in at the login screen

The login screen refuses root, even with a password set. Sign in as yourself and use sudo instead. We do not recommend changing this: every app you open would run with full control of the system.

SSH

Root can only log in with a key

Ubuntu’s SSH server is set to PermitRootLogin prohibit-password, so a root password never works over SSH. Root can only log in with an SSH key. To see the setting on a machine running the SSH server:

Show the root login setting
sudo sshd -T | grep -i permitrootlogin

without-password is another name for the same setting.

If Something Goes Wrong

Fix

su says Authentication failure

Root is still locked, or the password is wrong. Check with sudo passwd -S root. If it shows L, set a password as in step 2, or use sudo -i instead.

Fix

sudo says you are not in the sudoers file

Your account is not an administrator. Sign in as a user who is, add your account to the sudo group, then log out and back in:

Give a user admin rights
sudo usermod -aG sudo mike

Use your username in place of mike.

Fix

You forgot your own password and root is locked

For a fuller walkthrough, see how to reset an Ubuntu root or administrator password. Restart and hold Shift, or press Esc on a UEFI machine, to open the boot menu. Choose Advanced options for Ubuntu, then a (recovery mode) entry, then root. At the root prompt:

Reset your password from recovery mode
mount -o remount,rw /
passwd mike

Use your username, then type reboot.

Helpful Resources

passwd manual for 26.04 ↗Every passwd option, including -S, -l and -u
sshd_config manual ↗What each PermitRootLogin value allows
sudo-rs ↗The sudo that ships with Ubuntu 26.04, and how it differs
r/Ubuntu ↗Ask about sudo and root and see what worked for others

Frequently Asked Questions

Is the root account enabled on Ubuntu?

No. Ubuntu installs with the root account locked. Your own account does admin work with sudo, using your own password.

What is the default root password on Ubuntu?

There is none. Root has no usable password until you set one with sudo passwd root.

How do I switch to root on Ubuntu?

Run sudo -i and enter your own password. That works with root locked. If you have given root a password, su – also works, using the root password.

How do I disable the root account on Ubuntu?

Run sudo passwd -l root. Check it with sudo passwd -S root: the second field should read L.

What is the difference between sudo -i and su?

sudo -i asks for your own password and works with root locked. su – asks for the root password, so root must have one.

Is it safe to enable the root account?

It works, but it adds a second password that controls the whole system. Most people never need it. If you enable it for a task, lock it again when you are done.

Root locked again?
Keep Ubuntu secure

The commands for checking users, logins, open ports and updates on an Ubuntu system.

Linux security commands

More guides: Back Up Files on Ubuntu · Things to Do After Installing Ubuntu 26.04

Views: 3,753

Please Share this:

  • Share on Facebook (Opens in new window) Facebook
  • Share on X (Opens in new window) X
  • Share on Reddit (Opens in new window) Reddit
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Pinterest (Opens in new window) Pinterest

Tags: passwdRootroot accountSudo Commandubuntu 26.04

Share on Facebook
Share on X
  • Next Download OpenRA Game
  • Previous How To Optimize Apache

You may also like...

  • Python on Ubuntu illustration with a developer at a computer

    How to Install Python on Ubuntu 26.04 and 24.04

  • VPNs smooth

    Some VPNs that work smoothly on Ubuntu

  • Cover art printer drivers - How to Install Printer Drivers on Ubuntu 26.04 - HP, Brother, Canon & Epson

    How to Install Printer Drivers on Ubuntu 26.04 – HP, Brother, Canon & Epson

Everything Ubuntu 26.04!

    • » Download Ubuntu 26.04 LTS
    • » Download Ubuntu Server 26.04
    • » Under $5 VPS Hosting
    • » Ubuntu 26.04 Wallpapers
    • » Upgrade to Ubuntu 26.04 LTS
    • » Things to Do After Installing 26.04
    • » Ubuntu Server 26.04 Manual
    • » Avast Antivirus for Linux
    • » Best Ubuntu 26.04 Games
    • » Best Ubuntu 26.04 Themes
    • » Best Ubuntu 26.04 Software
    • » Official Ubuntu Flavors to try
    • » Ubuntu Shortcuts (PDF) NEW
    • » Free Backup Software for Ubuntu

Follow us by Email & Join 8,146+ Subscribers!

Enter your email address to subscribe to this blog & receive notifications of new articles relating to ubuntu gaming, linux updates, apps & more.

User Online

1,293 Users Online.

Latest Posts

  • How to Install Python on Ubuntu 26.04 and 24.04

  • How to Install TypeScript on Ubuntu 26.04 and 24.04

  • How to Install Bun on Ubuntu 26.04 and 24.04

  • How to Change or Reset the Root Password on Ubuntu 26.04

  • NVIDIA 620 Linux Driver Brings Wayland Fixes to Ubuntu in 2026

Ubuntu Apps: Editors Picks!

» Best Media Players for Ubuntu
» Top Audio Editors for Ubuntu
» Best Browsers for Ubuntu
» Best File Managers on Ubuntu
» Best Antivirus Apps on Ubuntu
» Top Open Source AI Tools on Ubuntu
» Teamviewer on Ubuntu
» Docker on Ubuntu
» Spotify on Ubuntu
» Steam on Ubuntu
» Discord on Ubuntu
» WhatsApp on Ubuntu

Explore Linux!

» Try Linux Distros Online
» Best Linux Distro for Gaming
» Most Popular Linux Distros
» Best Linux Distros for Beginners
» Best Linux Distros for Developers
» Best Linux Distro for Old Computers
» Best Linux Distro for Security & Privacy
» Best VM Software on Linux
» Best Linux Websites

Fun games to play on Linux

  • Last Epoch Official Header

    Download Last Epoch Game

  • Crusader Kings 3 Official Logo

    Crusader Kings III for Ubuntu

  • Cozy Gaming

    Try these 5 Linux games for a cozy evening in 2025

  • Wizard of Legend for Linux

    Download Wizard of Legend Game

  • Civilization 6 Official Cover

    Download Civilization VI Game

Ubuntu Gaming Guide!

🎮 Best Action Games

🗺️ Best Adventure Games

🤝 Best Co-op and Multiplayer Games

🎯 Best FPS Games

🎁 Best Free Games

👻 Best Horror Games

🏎️ Best Racing Games

🎲 Best Roguelike Games

⚔️ Best RPG Games

🕹️ Best Simulation Games

🏀 Best Sports Games

♟️ Best Strategy Games

Popular Ubuntu Apps

  • Download Lector for Ubuntu

  • Download Synfig Studio for Linux

  • Download GNOME Tweak Tool

  • Best Code Editors for Ubuntu – Modern, Lightweight, and Terminal Picks

  • CrossOver on Ubuntu 26.04: Install Guide

About Us | Contact Us | Meet The Team | Advertise with us | Write for us | Privacy Policy [ Property of Oxavi Group Inc. ]