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

How to Enable and Disable Root User Account in Ubuntu

Written by Admin, Updated On May 7, 2019
password, security, terminal, ubuntu
How to Enable and Disable Root User Account in Ubuntu

In Ubuntu system, root user account is disable by default for improve security of system. At the installation time of Ubuntu Linux the root user is creating automatically but not asking to set password for root user. In Linux, a user account without password or empty password is considered as a disabled account. This tutorial outlines how to enable and disable root user account in Ubuntu Linux.

We are strongly recommend to only use the sudo user account instead of enabling root account. You can perform all the operations using sudo enabled user account.

Sudo Users#

Generally, a regular Ubuntu user can perform administrative tasks by granting administrative privileges known as sudo. Sudo enabled users are authorized to perform same as root user account.

To grant a sudo access to a normal user you just have to make member of sudo group. In Ubuntu, members of sudo group have permission of sudo access. By default, initial created user is already member of sudo group so that user have sudo access.

If you want to create a sudo user on your Ubuntu system follow this tutorial.

Enable Root User Account in Ubuntu#

To enable the root user you just have to set password for root user. You can set password for a user account using passwd command. As a initial user account you should have sudo privileges to change password of another users. Run the below command:

sudo passwd root

After that, It will prompt you to enter password and confirm password for root user account as given below:

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

It’s strongly recommend that you set strong and unique password. It is a most important security aspect of your system. Your password should have at least 14 characters and contains one uppercase letter, one lowercase letter, one number, and one special character.

Finally, you have successfully enabled the root account by setting up password. Now you can login as root user on your Ubuntu server.

Disable Root User Account in Ubuntu#

If you have enable root user account on your Ubuntu system and want to disable then simply set the password to expire. Execute the below command:

sudo passwd -l root

Conclusion#

In this guide, you have learned how to enable and disable root user account in Ubuntu system.

If you have any more questions or suggestion please write down at comment box.

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 Install Git on Debian 9 System
Next Article   How to Set Up SSH Keys on Debian 9 System

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