• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Change Root Password in Ubuntu Linux

Written by Admin, Updated On December 15, 2019
password, terminal, ubuntu
How to Change Root Password in Ubuntu Linux

In this tutorial you will learn how to set or change the root password on Ubuntu Linux.

In all Linux systems, root user is a special user account (superuser). Using root user you can perform all the command and get access to any resource on the system without any restrictions.

By default, the root user account disabled in Ubuntu Linux for security reasons. As a result, you can not login using root user or use a command such as su - to become a SuperUser.

Change root password in Ubuntu#

In Ubuntu Linux root user account is exist just it has been disabled for security reasons. Logging in as root is not possible because no password has been set for the root account. To enable the root account you need to set a password for root user. You need to use the passwdcommand to change or set the password for user accounts on Ubuntu Linux.

Execute the below command as a sudo user to change password on Ubuntu Linux:

sudo passwd root

It will prompt you to enter and confirm the new root password.

You should make sure your password is strong and unique. A strong password includes 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

Alright, it’s done! The root password has been changed.

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

Understanding passwd command option#

  • -d OR –delete : Delete a user’s password (make it empty for root user). This is a quick way to disable a password for an account. It will set the named account passwordless.
  • -l OR –lock: Lock the password of the named account such as root. This option disables a password by changing it to a value which matches no possible encrypted value (it adds a ‘!’ at the beginning of the password)
  • root : Lock and disable root account i.e. re-disabling your root account

Conclusion#

By default, the root user account disabled in Ubuntu Linux so you can use the sudo command to run commands with root-level access. You can log in as root directly after setting the root password.

If you have any questions or feedback, feel free to leave a comment.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Change Hostname on CentOS 8
Next Article   How to Install WordPress with Apache on Ubuntu 18.04

Related Posts

  • How to Install and Use PHP Composer on Ubuntu 22.04

    How to Install Composer on Ubuntu 22.04

    January 31, 2023
  • How to Install Nginx on Ubuntu 22.04

    How to Install Nginx on Ubuntu 22.04

    January 28, 2023
  • How to Install Puppet Agent on Ubuntu 22.04

    How to Install Puppet Agent on Ubuntu 22.04

    January 22, 2023

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install SSH Keys on Ubuntu 22.04
    How to Set up SSH Keys on Ubuntu 22.04 January 7, 2023
  • How to Install Mongodb on Debian 11
    How to Install MongoDB on Debian 11 Linux January 11, 2023
  • How to Install Puppet Agent on Ubuntu 22.04
    How to Install Puppet Agent on Ubuntu 22.04 January 22, 2023
  • How to Install Jenkins on Debian 11
    How to Install Jenkins on Debian 11 January 5, 2023
  • How to Change-Hostname Ubuntu 22.04
    How to Change Hostname on Ubuntu 22.04 January 19, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook