It comes a time when for some reason someone forgets the login password for their
computer, hence they become unable to access the computer. That is not the end, there is always something that can be done.
All you need is a working keyboard and familiarity with a few commands in fixing this problem and access to the computer as this cannot be fixed remotely. First, you will have to reboot your computer, hold shift until you are able to access a screen as shown below. This screen offers various troubleshooting options for your computer. It’s necessary to understand some of these functions to make use of them when necessary, with computers anything happens. Equipping oneself with basic tools is always good. Here you will be shown on how to unlock a forgotten sudo password on both dual booting and single booting computers. By dual booting, I mean recovering a sudo password on a computer running several Oss Ubuntu included. By single booting I mean, resetting a password on a computer running Ubuntu alone. There is a very slight difference in the procedure, but the end of the process is similar. For instance, when dual booting, there is an option with advanced choices. So when dual booting, the recovery menu can be easily accessed through the grub menu when a computer is booted. The rest of the process, however, remains the same.
This is when Ubuntu is the only operating system running. To get to this menu, hold shift after booting on the computer. It simply takes you to this menu. Using the navigational keys on the keyboard, scroll the “advanced options for Ubuntu option” as shown below.
Press Enter to get to the next screen like the one shown below. Here, you will be given several options
Scroll down to the “root” option which has a description – Drop to root shell. This option gives you root access to the system in a read-only mode. Selecting this option will move you to the next screen which is a command line like the one below.
Please note that:
1 – In case you are unable to remember your username, type in the command “ls /home” (should be in small letters) then press enter. This will provide a list of usernames available on the system.
2 – When dual booting, Ubuntu recovery menu can be easily accessed via the Grub menu when the computer is booting. If that’s the case, there is no need to hold the shift key during startup as the advanced options menu is available by default in grub boot loader.
In the command line, type – mount -0 rw, remount / – this allows the user to make changes in a read-write mode.
Remember, by default, the file system loads in a read-only mode, hence it could be impossible to make changes. This first command enables read-write mode.
After entering the command above, the command line should introduce a new line where one will be able to enter the following command which takes you to password option. It is written as passwd followed by the username e.g passwd linuxandubuntu.
At this point, you will be given an option of changing your password without putting the old one. Enter and re-enter your password and done! Up to this point, you have successfully changed your password. Simply type Exit and press enter to go back to normal system booting. You will now be able to use your new password on the new prompt.
from LXer Linux News http://lxer.com/module/newswire/ext_link.php?rid=248040