Login lockout

Q Can you help me get PCLinuxOS 2007 to boot again? I have it installed on its own hard drive and I was slowly getting to grips with it, but during a recent house move I lost the notebook containing my login details. One forum suggested I just put the DVD back in and reload it - I've tried, but I still get asked for login details. I'm at a loss as to what to do next, so any help would be appreciated.

A You're still booting from the hard disk. To boot from the DVD, you need to call up your BIOS's boot menu to choose the DVD as your boot device. You should see a message flash up when the computer first starts, telling you to press one key for settings and so on. Unfortunately, the key used varies from one motherboard to the next - the four computers here use F8, F11, F12 and Esc. Sometimes the message refers to a BBS menu. It should also be explained in your motherboard manual, if that isn't lost along with the book containing your passwords. If you can't get a boot menu, call up the BIOS settings page and change the boot order so that CD/DVD comes before the hard disk. Once you've booted from your Live CD, there's no need to reinstall; you can reset the password with a couple of terminal commands. Open a terminal by clicking the Konsole icon and run these commands

su -
mount /dev/sda1
chroot /mnt/sda1
passwd yourusername

su gives you root access and the password is root. The next command mounts the root filesystem, PCLinuxOS installs to /dev/sda1 by default, then chroot enters that directory and makes it the root directory. Until you log out, you're now inside your original PCLinuxOS installation. You may see some errors about permissions in /dev/null when you run chroot, but you can safely ignore them. Now that you're inside your original installation, logged in as root, you can change the password with the passwd command

passwd myuser

Enter the password twice when prompted and try not to forget or lose it this time. If you have forgotten your login name too, you can see all the usernames in the file /etc/passwd.

cat /etc/passwd

Your username will be at, or very near, the end of this file. You can also reset the root password by running passwd with no username. Once you've reset the passwords, press Ctrl+D to log out of the root session and then reboot, letting it boot from the hard disk this time. You can now log in with your new password and username.

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar