My current ubuntu Administrator account has Automatic login ON.I was wondering if there was a way to recover the current password with my account logged in without recovering it from GRUB.
Asked
Active
Viewed 9.5k times
2 Answers
8
Reading the comments under your question, it seems as you have lost total access to your root account. So you can neither run sudo passwd from a normal session, nor can you access the recovery shell, which requires the root password. So you have the following options left:
Either reinstall your system...
or reset the password from a live USB/DVD system. Follow these steps:
- If you already have an Ubuntu DVD or USB stick, skip to step 4.
- If you don't have an Ubuntu- or other Linux-ISO file, download one, e.g. the current Ubuntu release.
- Burn it to a DVD (e.g. with Brasero) or extract it to an USB stick (e.g. with Startup Disk Creator or any similar program which doesn't ask for root permission)
- Boot the DVD or USB and select "Try Ubuntu without installing"
- From within the live system, open a terminal and find out, which is your system partition:
sudo parted -l. This will list all your partitions, of all connected drives. Your USB stick partition will be mounted as/, so it'll be another drive. Search for an EXT4 partition, which (when using Legacy BIOS) has thebootflag and fits the size of your system. - Mount this partition r/w:
sudo mount /dev/sdXY /mnt -o rw - Open a root shell in the mounted system:
sudo chroot /mnt - Reset the root password:
sudo passwd, enter new password twice. exit- Unmount the system partition:
sudo umount /mnt - Reboot into your system.
s3lph
- 14,644
- 12
- 60
- 83
2
booting into livecd to change password is not necessary. It's enought to:
- when system is booting, in grub menu - enter via "e" key to edit command line.
- add there something like init=/bin/bash
- when you have prompt - change password using passwd command. sometimes it's necessary to remount root partition into rw (mount -o remount,rw)
- after change - do "sync" command to write change into disk, and then reboot system.
Sometimes it's worth to do backup of /etc/shadow file (cp /etc/shadow /etc/shadow.backup) - for example when you really need to recover old password, because your home directory is encrypted with it... - then after loggin you can try to find your password using john tool from old shadow file.
undefine
- 478