How to change root user password on Ubuntu

The root user (or super user) is a special user account on all Linux and Unix systems. It has access to all commands and all resources on the system without any restrictions.

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

This guide explains how to temporarily modify the root user account and how to modify the root user password on an Ubuntu system.

1. Temporarily switch to root user##

Ubuntu users are encouraged to perform sudo privileges through normal users before performing system management related tasks. Sudo allows authorized users to run programs as other users, usually the root user.

The Ubuntu installation is a member of the sudo user group by default. It is possible that the user you logged into the system has been granted administrative rights.

To temporarily elevate the root user's authority, add sudo before the command:

sudo command-name

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

In the currently logged-in session, to temporarily switch to the root account, you can use the sudo su or sudo -i command, and then enter the user password:

sudo su -

Run the whoami command to verify whether the current user identity has been changed:

whoami
root

Two, modify user password##

The root user is disabled by default, but it does not mean that the root user account is removed. It is impossible to log in with the root account, because the root account has no password set.

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

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 user password.

When setting a password, please make sure that the password you use is a unique and strong password. Having a strong password is the most important part of account security. Usually a strong password has at least 16 characters, at least one uppercase letter, one lowercase letter, one number, and one special symbol.

When you enter the password, the password will not be displayed on the screen:

Enter newUNIX password:
Retype newUNIX password:
passwd: password updated successfully

And that's all! The root account password has been changed.

Now you can log in to your Ubuntu system with the root account and the new password.

Three, summary##

By default, in the Ubuntu system, the root account has no password. The recommended way is to use sudo to run root-level commands.

To log in directly as root, you need to set a root password.

Recommended Posts

How to change root user password on Ubuntu
How to change PHP settings on Ubuntu 14.04
How to change MySQL password under Ubuntu
How to install Ruby on Ubuntu 20.04
How to install Memcached on Ubuntu 20.04
How to install Java on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
How to install VirtualBox on Ubuntu 20.04
How to install Elasticsearch on Ubuntu 20.04
How to install Protobuf 3 on Ubuntu
How to install Nginx on Ubuntu 20.04
How to install Apache on Ubuntu 20.04
How to install Git on Ubuntu 20.04
How to install Node.js on Ubuntu 16.04
How to install MySQL on Ubuntu 20.04
How to install Vagrant on Ubuntu 20.04
How to install Bacula-Web on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 16.04
How to install Git on Ubuntu 20.04
How to install Anaconda3 on Ubuntu 18.04
How to install Memcached on Ubuntu 18.04
How to install Jenkins on Ubuntu 16.04
How to install MemSQL on Ubuntu 14.04
How to install Go on Ubuntu 20.04
How to install MongoDB on Ubuntu 16.04
How to install Mailpile on Ubuntu 14.04
How to install PrestaShop on Ubuntu 16.04
How to upgrade to PHP 7 on Ubuntu 14.04
How to install Skype on Ubuntu 20.04
How to install Jenkins on Ubuntu 20.04
How to install Python 3.8 on Ubuntu 18.04
How to install KVM on Ubuntu 18.04
How to install opencv3.0.0 on ubuntu14.04
How to install Anaconda on Ubuntu 20.04
How to install Prometheus on Ubuntu 16.04
How to install Jenkins on Ubuntu 18.04
How to deploy Django on Ubuntu 14.04
How to install Apache on Ubuntu 20.04
How to install Solr 5.2.1 on Ubuntu 14.04
How to secure Nginx on Ubuntu 14.04
How to install MariaDB on Ubuntu 20.04
How to install Nginx on Ubuntu 20.04
How to install Mono on Ubuntu 20.04
How to install Zoom on Ubuntu 20.04
How to uninstall software on Ubuntu
How to install Nginx on Ubuntu 16.04
How to install OpenCV on Ubuntu 20.04
How to install Spotify on Ubuntu 20.04
How to install Postman on Ubuntu 18.04
How to install Go 1.6 on Ubuntu 16.04
How to install Go on Ubuntu 18.04
How to install MySQL on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 20.04
How to install VLC on Ubuntu 18.04
How to install TeamViewer on Ubuntu 20.04
How to install Webmin on Ubuntu 20.04
How to set up password authentication with Nginx on Ubuntu 14.04
How to set up vsftpd for user directories on Ubuntu 16.04
How to create a Sudo user on Ubuntu [Quick Start]
How to add swap space on Ubuntu 20.04
How to install Docker Compose on Ubuntu 18.04