Linux Administration password



Tolkem

Well-Known Member
Credits
8,516
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:
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online


Top