Breaking your root password to access the root user 2
I have forgotten my root password! How can i do to access my root user commands? 3
How to reset your root password The root password is the one you use when you run the $ su command on your system If you don’t know or you can’t remember that password, you will not be ableto access the superuser (root) commands Thus you will just run regular user commands 4
5 Trust me, this situation constantly occurs. Let’s learn how we can recover or set a new root password!
Exercise You have forgotten your root password and you want to run a root command. Reset the root password. NB: The new password must be Password01 6
Firstly , we need to shutdown the server Hope you remember how to do that in VirtualBox! Click on the button to close the window (follow the steps 1 and 2) How to reset the root password ? 7 1 2
Now, boot up the server, wait patiently not to miss the countdown. Be ready on the keyboard As soon as you see the following screen, press the key “ e ” on the keyboard NB: If you miss the countdown, you can turn off the server and start it back How to reset the root password ? 8
Use the down arrow to look for the line starting with linux16 Then use the right arrow key to move to the end of the line Put a space and type rd.break Hold the Ctrl key and press x ( Ctrl-x ) How to reset the root password ? 9
The page will refresh and present the following lines with the # sign at the end How to reset the root password ? 10
Now we need to mount the root file system ( sysroot ). Run the following commands successively. Don’t forget to press Enter at the end of each! # mount -o remount,rw /sysroot # chroot /sysroot # passwd root Enter the new password that is Password01 Retype the same password for confirmation. How to reset the root password ? 11
The command we typed previously completely removed the selinux context . We need to reset it by creating a specific file. To do that, run: # touch /.autorelabel Now exit twice to logout # exit # exit The system will reboot itself . This might take some few minutes (It might be faster depending on your computer) How to reset the root password ? 12
13 What is SElinux ? Security-Enhanced Linux(SElinux) is a security feature in linux systems that monitors system accesses.
When that is done, login with the user student and open a terminal Try the $ su command and type the new password How to reset the root password ? 14
15 Place your screenshot here When that is done, login with the user student and open a terminal Try the $ su command and type the new password How to reset the root password ?
😉 16 Practise this on one of your servers and find out if you are able to break into your system See you guys in the next lesson!
17 Thanks! Any questions? You can find me at: website : abdasmarttechsolutionsllc.com Phone: +1 (612)249-3623 Email : [email protected]