Removing Linux user passwords
All you need is a USB stick loaded with a live distro, Ubuntu in "Try mode" is enough.
If distro doesn't load directly and BIOS has a password meaning you can't change boot order, you would need to open the system and remove the CMOS battery located in the motherboard for a couple minutes, so the BIOS resets to default.
Once inside the live distro we have root privileges, so all we need to do is mount the root file system (AKA partition where the SO is installed) and access it as root:
#To look for partitions on the system
lsblk
#Create a directory to mount the partition we want to access
sudo mkdir /media/partition
sudo mount /dev/sdaN /media/partition
#Access it as root in the mounted partition
sudo chroot /media/partition
Once you chroot you could simply change the password with passwd
You could too edit the /etc/shadow
file without the need of chroot, open the file with an editor like nano
and leave the pass field of the user blank user::~
or add a new password with openssl passwd -6
and place the hash result in the pass field.
Last updated