Ubuntu password is incoorect

34 Views Asked by At

I was working on password policy and set these values according to benchmark

I edit the /etc/pam.d/common-auth configuration file and add or modify the pam_tally2.so or pam_faillock.so lines as appropriate:

 auth required pam_tally2.so onerr=fail audit silent deny=5 unlock_time=900
 auth required pam_faillock.so preauth audit silent deny=5 unlock_time=900
 auth sufficient pam_unix.so
 auth [default=die] pam_faillock.so authfail audit deny=5 unlock_time=900
 auth sufficient pam_faillock.so authsucc audit deny=5 unlock_time=900

after changes in /etc/pam.d/common-auth

I'm unable to log in to my ubuntu machine it said "incorrect password"

if anyone know How I can reset my password please let me know I will be very thankful to you .

Note: I tried common solution on google they are not working in my case

1

There are 1 best solutions below

0
flymerry On

You can use a USB drive with an Ubuntu (for example) ISO to reset your password.

BE VERY CAREFUL : mistakes could lead to data loss

The main steps are :

  • Booting from the USB drive (access the BIOS settings to do so, you might need to disable Secure Boot) and select "Try Ubuntu"

  • Mount your system partition (use lsblk to find it):

     sudo mkdir /mnt/os
     #assuming your system partition is /dev/sda1 :   
     sudo mount /dev/sda1 /mnt/os   
    
  • Mount some necessary directories and chroot into your system

     sudo mount --bind /dev /mnt/os/dev
     sudo mount --bind /proc /mnt/os/proc
     sudo mount --bind /sys /mnt/os/sys
    
     sudo chroot /mnt/os
    
  • Reset you password (you can also edit the /etc/pam.d/common-auth configuration file to revert your changes)

     passwd <your-username>
    
  • Type exit to exit the chroot environment and umount the partitions

      sudo umount /mnt/my_system/dev
      sudo umount /mnt/my_system/proc
      sudo umount /mnt/my_system/sys
      sudo umount /mnt/my_system
    
  • Reboot and remove the USB drive, connect with your new password