Linux-Ubuntu forget the user password solution
[System version]: Ubuntu 12.04
【Solution】:
-
Restart the system, press and hold the shift key to enter the grub menu;
-
Select recovery mode recovery mode;
- Select root drop to root shell prompt in the recovery menu;
- Enter passwd username in the command line;
If the word “successful” appears, it means that the modification is successful. If it is like the above, it means that the modification is not authorized.
The solution at this time:
Remount the root directory / in read-write mode, enter mount -o rw,remount /
Change the password again to succeed.
- The above is to modify the user name and password, modify the root password: passwd "user name", and then type the password twice to modify the user name and password.
About mount -o rw,remount /
It should be noted that the mount point must be an existing directory, and this directory may not be empty. Generally used for files in this directory is ro permission, which needs to be temporarily changed to modifiable permission.
parameter:
- o <Options> Specify options when mounting the file system, some of which can also be written in /etc/fstab. Commonly used ones are:
defaults use the default values of all options (auto, nouser, rw, suid)
auto/noauto allow/disallow installation with the -a option
dev/nodev interprets/does not interpret special devices on the file system
exec/noexec allow/do not allow execution of binary code
suid/nosuid confirm/not confirm the suid and sgid bits
user/nouser allows/does not allow general users to mount
codepage=XXX code page
iocharset=XXX character set
ro mount as read-only
rw mount in read-write mode
remount reinstall the installed file system
loop mount "loop device" and "ISO image file"