As the saying goes, good memory is better than bad writing. Sometimes when the brain is hot, I can not remember what the password was set before. I poor forgot my ubuntu server password, recall the n combinations are not, so can only be single-user mode change password.
The following actions are based on the password I forgot the user name Pcat.
1. Enter the single-user mode to change the password
When booting to the Grub interface, press the up and down keys to move to advanced options for Ubuntu, enter in to choose Ubuntu, with Linux 4.2.0-27-generic (recovery mode), Press E (instead of press Enter) to enter the edit state, press the up and down keys to move to the following, find the RO recovery nomodeset, change it to
Press Ctrl+x or F10 to enter single-user mode, which is the root permission,
To force the PCAT user's password to be modified:
passwd Pcat
Enter a new password and repeat it again, that is, the modification was successful.
Then enter reboot if prompted as follows:
Shutdown:unable to shutdown system
Unable to shut down the system, then forced to shut down itself.
2, the new password in the desktop will be black screen
After a black screen, panic, and then I press Ctrl+alt+f5 (you can try F1 to F6) into the command line mode
Again with the new password login pcat, it is possible, and then want to enter the graphical interface again, enter
StartX
Unfortunately, the report:
inch file /home/pcat/. Xauthority
I thought for a long time, also searched for a long time, finally I input
ls /home/pcataccess-your-private-data.desktop README.txt
The original home directory can not display, and then show the 2 files, I was depressed, and then slightly recalled, I in the Ubuntu server installation when I chose to encrypt the home directory, even if I modified the PCAT user's password, but/home/pcat this directory is encrypted by the previous password. More bitter, I originally encrypted the home directory, after logging into the system did not go to save the key, as a ring.
(Before, the method of saving the key: in the terminal input
Ecryptfs-unwrap-passphrase
You can get a string of long strings that are kept in a safe place, which is key. This is so that encrypted files can be restored, and if necessary, search by yourself. )
3, can only be helpless to delete users, rebuild users
You can only enter into single-user mode to operate, or you may have previously set a password for root to switch to root.
Userdel Pcat rm -RF/homemkdir /-d/home/pcat-m pcatpasswd pcat
Ubuntu server forgot password, single-user mode change password can not go to the desktop helpless