+5 votes
256 views
How to reset CentOS 8 root password | Change password

in Linux / Unix by (552k points)
reopened | 256 views

1 Answer

+3 votes
Best answer

How to reset root password on CentOS 8

The root user, or superuser, in Linux is a special and very careful user since he has all the privileges available in the system to perform any available task such as creating, editing or deleting accounts, deleting or adding users and many more which if run incorrectly can lead to multiple errors in system services. We must bear in mind that this user is different from all the others and that therefore we have to use it with caution since otherwise we can change irreversible damage to the equipment..

As it is a special user, it is not used frequently and instead we put “sudo” before the commands executed to grant this privilege whenever we have the administrator password, so that something normal is that we forget the root password which is set from the moment the system is installed. This is something that can happen since the number of passwords every day is very large, because many applications , emails, web pages, etc. require it. That is why those passwords that we do not use too often, such as the root user on our PC, we forget if we have not written it down anywhere to be able to remember it easily.

If this is your case (you have forgotten the password) you should not worry since in this tutorial we will explain how to reset this password in CentOS 8 step by step so that you can run this process on your PC..

To stay up to date, remember to subscribe to our YouTube channel! SUBSCRIBE

How to reset root password on CentOS 8

Step 1

To start this process, we restart the system and on the first boot we will see the following:

image

Step 2

There we enter the letter "e" to access the CentOS 8 editing console:

image

Step 2

There we place the word "ro" (read-only) which is in front of the path root = / edv / mapper / cl-root and replace "ro" with "rw" and add the following line:
 init = / sysroot / bin / sh 

image

Step 3

After this we will use the Ctrl + X keys to access the simple mode and there we will enter the following:
 : / # chroot / sysroot 
image
Step 4

This will mount the root file system in read and write mode, then we enter the following:
 : / # passwd root 
Step 5

Pressing Enter you must confirm the new passwords: image
Step 6

We proceed to enable SELinux re-labeling with the following command:
 : / # touch /.autorelabel 
image
Step 7

We exit the editor and restart CentOS 8 with the lines:
 : / # exit : / # reboot 
After this it will be possible to log in to CentOS 8 as root user by entering the new password that we have defined: image

With this simple procedure it will be possible to recover the root user password in CentOS 8 and in this way manage the user in the system in a much more appropriate way. You must bear in mind that this password is very important and therefore it must be strong and secure so that our team is safe.


by (3.5m points)
edited

Related questions

+3 votes
1 answer
asked Apr 28, 2020 in Linux / Unix by backtothefuture (552k points) | 261 views
+3 votes
1 answer
asked Apr 27, 2020 in Linux / Unix by backtothefuture (552k points) | 440 views
+5 votes
1 answer
asked Nov 14, 2019 in Mac by backtothefuture (552k points) | 275 views
+5 votes
1 answer
asked Apr 27, 2020 in Linux / Unix by backtothefuture (552k points) | 499 views
+4 votes
1 answer
asked Oct 8, 2020 in Linux / Unix by backtothefuture (552k points) | 360 views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users