Ubuntu 26.04: Enable Root User Account
Enable the root user account on Ubuntu 26.04 LTS using sudo and su, with security restrictions via pam_wheel.
May 22, 2026 • 4 min read
ubuntulinuxrootadministrationsecurity
The root account in Ubuntu is disabled by default because its password is not set. To use root privileges, it is generally better to use sudo with administrative accounts. However, if you need to use the root account itself, configure as follows.
Get Root Shell via Sudo
The user created during installation is an administrative account with sudo access. Get a root shell directly:
sudo -s
[sudo] password for ubuntu: # input your password
root@localhost:/home/ubuntu# # switched to root
Enable and Use the Root Account
Set a password for the root account, then switch with su:
sudo passwd root
[sudo] password for ubuntu: # input your password
New password: # set root password
Retype new password: # confirm
passwd: password updated successfully
su -
Password: # input root password
root@localhost:~# # switched to root
Restrict su Access to Root
For security, restrict which users can use su to become root. Edit the PAM configuration:
vi /etc/pam.d/su
Uncomment line 15 and add a group:
auth required pam_wheel.so group=adm
Add a user to the allowed group:
usermod -aG adm ubuntu
Now only members of the adm group can use su to become root.