YouTube Icon

How to Change Root Password in Ubuntu Linux

How to Change Root Password in Ubuntu Linux

The root user (or superuser) is a special user account that is present on all Linux and Unix-like systems. It has full access to every command and any resource on the system without any restrictions.

If you are coming to Ubuntu from another Linux distribution, you may wonder what the default root password is or how to change the root password. By default, in Ubuntu, the root user account is disabled for security reasons.

This tutorial explains how to temporally change to the root user account and how to set the root password on Ubuntu systems.

Temporary Switching to root

Ubuntu users are encouraged to perform system administrative tasks by granting sudo privileges to regular users. Sudo allows authorized users to run programs as another user, usually the root user.

The initial user created by the Ubuntu installer is already a member of the sudo group. The chances are that the user you are logged in as is already granted with administrative privileges.

To temporarily elevate root user privileges, run the command prefixed with sudo:

sudo command-name

The first time you use sudo in a session, you will be prompted to enter the user password.

To temporally switch to the root account in the current login session, you can use either the sudo su or sudo -i command and enter the user password:

sudo su -

Run the whoami command to verify that the user is changed:



Changing Root Password

The root user is disabled, but that doesn't mean that the root account has been removed. Logging in as root is not possible because no password has been set for the root account.

If for some reason, you need to enable the root account, all you need to do is to set a password for the root user. In Ubuntu, you can set or change the password of a user account with the passwd command.

To change the password of the root user in Ubuntu, run the following command as a sudo user:

sudo passwd root

You will be prompted to enter and confirm the new root password.

When setting the password, make sure you're using a unique and robust password. Having a strong password is the most important aspect of the security of your account. Often a strong password has at least 16 characters, at least one uppercase letter, one lowercase letter, one number, and one special character.

The password is not shown on the screen when you type it.

Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

That's it! The root password has been changed.

You can now log in to your Ubuntu system as root using the new password.


By default, in Ubuntu, the root account has no password set. The recommended approach is to use the sudo command to run commands with root-level privileges.

To be able to log in as root directly, you'll need to set the root password.

Author Biography.

Lokesh Gupta
Lokesh Gupta

Overall 3+ years of experience as a Full Stack Developer with a demonstrated history of working in the information technology and services industry. I enjoy solving complex problems within budget and deadlines putting my skills on PHP, MySQL, Python, Codeigniter, Yii2, Laravel, AngularJS, ReactJS, NodeJS to best use. Through Knowledge of UML & visual modeling, application architecture design & business process modeling. Successfully delivered various projects, based on different technologies across the globe.

Join Our Newsletter.

Subscribe to CrowdforThink newsletter to get daily update directly deliver into your inbox.

CrowdforGeeks is where lifelong learners come to learn the skills they need, to land the jobs they want, to build the lives they deserve.


CrowdforThink is a leading Indian media and information platform, known for its end-to-end coverage of the Indian startup ecosystem.


Our mission is "Har Koi Dekhe Video, Har Ghar Dekhe Video, Ghar Ghar Dekhe Video" so we Provide videos related to Tutorials, Travel, Technology, Wedding, Cooking, Dance, Festivals, Celebration.

Apna Video Wala

News & Blogs


How to Install Android Studio on Ubuntu 18.04

Android Studio is a full-featured cross-platform IDE that helps you build applications on every t...


How to Install Tor Browser on Ubuntu 18.04

Tor Browser routes your web traffic through the Tor network, making it private and anonymous. Whe...


How to Install Netbeans on Ubuntu 18.04

Netbeans is a full-featured cross-platform IDE that helps you build applications in Java, PHP, an...

Top Authors

Lamia Rochdi is the Marketing Manager at Bell Flavors & Fragrances EMEA. A successful family-...

Lamia Rochdi

I’m Mertin Wilson a technician in a camera company and certified expert of different P...

Mertin Wilson

Zakariya has recently joined the PakWheels team as a Content Marketing Executive, shortly after g...

Zakariya Usman

Pankaj Singh is a Senior Digital Marketing Consultant with more than 2 years of experience in SEO...

Pankaj Singh

Our Client Says

WhatsApp Chat with Our Support Team