Mar 23, 2015 · Reboot your Mac then press & hold Command + R when it's booting up until you see a loading bar. You'll then be taken into recovery mode. Recovery mode has a UI, so use your mouse and select Terminal from the Utilities section of the menu bar. Type resetpassword in the terminal and hit Enter. This will load the password reset utility, where you can pick a user and give them a new password. The sudo command tells the system to run a command as a superuser, or root user. When you run a function using sudo, you'll usually have to enter your password. Some versions of Linux will elevate your user privileges for a set amount of time around (15 minutes) before reverting. Other versions only perform a single task with elevated privileges.
Command output can be piped, in sequence, to another commands. When executing cat /etc/passwd | grep root, it'll capture the output of the cat /etc/passwd command and pass it to grep root, which will then show the lines that match root. When the first command fail, it'll still execute the second command.The way on how you can reset a forgotten root password on a Linux system have not changed for many years. Resetting a root password on RHEL7 Linux system have not change much except that now we deal with SElinux and the system is now using systemd instead of init.Nevertheless, those who have already did reset root password on the Linux system will be with the following steps familiar.
NOTE: There are doube quotes ( " ) surrounding the passwords, but each password is wrapped in a single quote ( ' ) to allow for special characters. Here we use echo with the "-e" switch. This tell echo to read the "\n" as a newline. Then is is piped into the passwd "USERNAME" command. We can also use this to change the password ...8. Place your cursor on the kernel and replace everything that follows UUID with: "rw single init=/bin/bash"8. 9. Press CTRL-X to start the kernel in single user mode. 10. Following the usual boot message, you will see a shell root (no password prompt), simply enter the command: 'passwd' to modify the root user password.