Linux Administration password

Umar1004

New Member
Joined
Aug 22, 2021
Messages
2
Reaction score
0
Credits
21
How to reset linux administration password and username?
 

Attachments

  • 20210821_191429.jpg
    20210821_191429.jpg
    2.1 MB · Views: 200


How to reset linux administration password and username?
Did you forget your password? What distro is this? As far as I know, there are two ways you can recover/reset your password:
1. Create a live USB, boot the LIve OS, mount the partition to something like /mnt, mount and bind the necessary directories, chroot to /mnt, change your password.
2. I've only performed this procedure in Ubuntu and Debian based distros, and am not sure whether it'd work in others, i.e. Arch, Fedora, openSUSE. It is a similar procedure than chrooting, but without having to boot to a live USB:
2.1 Turn on your pc and when it starts booting press the shift key, so grub's menu is available.
2.2 When in grub's menu screen, press e to edit boot options.
2.3 Scroll down using the arrow keys, and add this at the end of the boot options rw init=/bin/bash, then press Ctrl + x to save changes and boot to a console. It should look something like this:
init.png

2.4 Now, you should be in command-line mode, logged in as root, change your password
Code:
passwd user_name
type in and confirm your password when asked.
2.4 Once the new password has been successfully set, type
Code:
sync
and hit Enter, then type
Code:
reboot -f
and hit Enter again. The system will reboot, and you should be able to log in with your new password. See the img below
grub6.png

2.5 Once you're logged in, launch a terminal and type
Code:
sudo passwd root
type in and confirm the new password.
That's it.
Hope this helps! :)
 
Last edited:

Staff online

Members online


Latest posts

Top