How can i find the current password in ubuntu without booting up into recovery mode?

Solution 1:

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:

  1. If you already have an Ubuntu DVD or USB stick, skip to step 4.
  2. If you don't have an Ubuntu- or other Linux-ISO file, download one, e.g. the current Ubuntu release.
  3. 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)
  4. Boot the DVD or USB and select "Try Ubuntu without installing"
  5. 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 the boot flag and fits the size of your system.
  6. Mount this partition r/w: sudo mount /dev/sdXY /mnt -o rw
  7. Open a root shell in the mounted system: sudo chroot /mnt
  8. Reset the root password: sudo passwd, enter new password twice.
  9. exit
  10. Unmount the system partition: sudo umount /mnt
  11. Reboot into your system.

Solution 2:

booting into livecd to change password is not necessary. It's enought to:

  1. when system is booting, in grub menu - enter via "e" key to edit command line.
  2. add there something like init=/bin/bash
  3. when you have prompt - change password using passwd command. sometimes it's necessary to remount root partition into rw (mount -o remount,rw)
  4. 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.