I have my CentOS virtual machine in my virtual box. But I forgot my root password. How can I change my root password?
Reboot the system and interrupt the boot loader sequence by pressing any key.
Move the cursor to the entry that needs to be booted.
Press e to edit the selected entry. Move the cursor to the kernel command line (the line that starts with linux, it looks like the below output.
Append rd.break options in the end of the kernel command line. This will break just before control is handed from the initramfs to the actual system.
Press Ctrl+x and reboot the system. At this point, a root shell will be presented, with the root file system for the actual system mounted read-only on /sysroot.
Remount /sysroot as read-write.
$ switch_root:/# mount -o remount,rw /sysroot
Switch into a chroot jail, where /sysroot is treated as the root of the file system tree.
switch_root:/# chroot /sysroot
Set a new root password here.
# passwd root
Make sure that all unlabeled files (including /etc/shadow at this point) get relabeled during boot.
sh-4.2# touch /.autorelabel
Type exit twice. The first will exit the chroot jail, and the second will exit the initramfs debug shell.
To configure SSH server to your system, ...READ MORE
Follow the below steps and procedures:
Must have ...READ MORE
You can use this:
stat -c "%a %n" ...READ MORE
You can use if-else branch to check ...READ MORE
Please check the below-mentioned syntax and commands:
To ...READ MORE
Generally, these two commands are used to ...READ MORE
To create new partition you can follow ...READ MORE
In Linux system netstat-tnlp command comes from ...READ MORE
To install nginx in your system, you ...READ MORE
To install python-poster in RedHat/CentOs, you can ...READ MORE
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.