search
top

How To Enable and Disable Root Account on Ubuntu Server 20.04

How To Enable and Disable Root Account on Ubuntu Server 20.04

Introduction

By default Ubuntu Server and Ubuntu in general does not enable the root account. Instead the installation creates a user with sudo privileges.  Most times this is enough but there are occasions in which the root user needs to be enabled. In this post we will cover how to enable and disable the account.

Enable Root on Ubuntu

Open an SSH session to you Ubuntu Server. The next step is easy, to enable just assign a strong and unique password, 16 character  and at least one upper case letter, one lowercase letter, one number and one special character are recommended.

$ sudo passwd root

Set User password

That’s it.

Disable Root

So you no longer want or need to have root enabled, so best to disable it by setting the account to expire. Type the following.

$ sudo passwd -l root

Conclusion

Hope this helps with enabling and disabling root account on Ubuntu Server. If you do not need to enable root access it is best to not enable it and create users with sudo privileges for your operations.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

top