By mistake I locked my admin account on Debian with passwd -l. I'm trying with live CD to unlock my account with no sucess. I've tried editing passwd file by removing x, but that didn't work.
If you have an account with
sudo permission, you can run:
sudo passwd root
to unlock root password.
If you don't have
sudo permission, you should boot into single user mode (by editing boot option if you use
grub) or using a
live cd, then editing
/etc/shadow file (not
/etc/passwd) to remove pair of exclamation mark
! before hash password, example:
root:!!<hash password here>:9797:0:::::
After that, reboot and now you can log in with root again.
The password is not store in
/etc/passwd the x is a dummy entry
/etc/shadow contains the password.
man shadow for more information.
You shouldn't even need to boot with a LiveCD, simply boot your system with either the string
1 or the word
single at the end of your
linux ... stanza when GRUB2 initially is displayed.
When booting the system if you access the boot menu options for the kernel from the GRUB2 menu, you can append the appropriate string at the end to gain single user mode access to your system.
linux /vmlinuz-3.13.5-101.fc19.x86_64 root=/dev/mapper/fedora_greeneggs-root ro rd.md=0 rd.dm=0 vconsole.keymap=us rd.lvm.lv=fedora_greeneggs/swap rd.lvm.lv=fedora_greeneggs/root rd.luks=0 vconsole.font=latarcyrheb-sun16 rhgb quiet LANG=en_US.UTF-8 single
NOTE: You typically hit the e key and then arrow down to the
linux ... line adding the string "single" to the end. Then hit the F10 to boot it.
Once booted you should be able to access your
/etc/shadow file and remove the existing password from root's entry, making it blank. If you then reboot the system you should be able to get in with a blank password and use
passwd to reset it.