Get a floppy or cd-rom bootable version of Linux such as knoppix. Boot that; then mount the hard drive such as #mount /dev/hda1 /mnt
Edit the /etc/password file for the user which will now be located as:
/mnt/etc/password. You might also need to remove (blank) the password entry for that user in /etc/shadow. You should b able to boot the original Linux and login.
First, the file is called /etc/
passwd, not /etc/password. You should see your account name in the results of "
tail /etc/passwd".
If Ubuntu uses GRUB, and I'm reasonably sure it does, all you have to do is press "e" when it briefly pauses before booting. You will then be able to edit the boot options. Go to the end of the line and enter "init=/bin/bash". This will bypass all startup procedures and give you root access. Run the "tail /etc/passwd"
command I mentioned earlier to identify your username. Your root filesystem will be mounted readonly, so you'll want to run "mount -o remount,rw /". Then set your password with "passwd
yourusername". It's possible to password
protect GRUB. If you encounter this, use Paracomp's method. You will need to edit etc/shadow. If you completely remove the longest string of junk between two colons, your password will be removed. Reboot, login, and set a new password with "passwd".
Here is how you can use the Live CD to change the administrative password on your machine if you have lost/forgot the current password.
Note that you can usually just boot into "Recovery Mode" and run the passwd command directly.- Boot the Ubuntu Live CD.
- Press Ctrl-Alt-F1
- sudo mount /dev/hda1 /mnt
- Depending on your machine it could also be sudo mount /dev/sda1 /mnt. If you created a custom partition layout when installing Ubuntu you have to find your root partition using the fdisk utility. See the section Finding your root partition.
- sudo chroot /mnt
You can now use the passwd command to reset a password.
Note: In the mount command, /dev/hda1 will need to be replaced with the partition where the root of the file system resides.
If you install some other system and lose the grub.
- Boot the Ubuntu Live CD.
- Press Ctrl-Alt-F1
- Find the partition where your /boot directory is (normally the root partition) check the previous tip for that.
- sudo mount /dev/hda1 /mnt
- sudo chroot /mnt
- grub
- find /boot/grub/stage1 (will output a partition name like (hd0,3) )
- root (hd0,3)
- setup (hd0)
- quit
- Now restart the system and remove the Live CD
- Well, this tutorial will help you reset your Ubuntu user account password, regardless of what reason you have for resetting it.
First, you have to reboot into recovery mode.
If you have a single-boot (Ubuntu is the only operating system on your computer), you may have to press the Escape key during bootup in order to see the boot menu. If you have a dual-boot (Ubuntu is installed next to Windows, another Linux operating system, or Mac OS X; and you choose at boot time which operating system to boot into), the boot menu should appear without the need to press the Escape key.
From the boot menu, select recovery mode, which is usually the second boot option. Recovery mode will log you into a terminal with the root account. The root account is the ultimate administrator and can do anything to the Ubuntu installation (including erase it), so please be careful with what commands you enter in the root terminal.
If you have forgotten your username as well, type
ls /home
That's a lowercase L, by the way, not a capital i, in ls. You should then see a list of the users on your Ubuntu installation. In this case, I'm going to reset Cynthia Heimel's password. To reset the password, type
passwd username
where username is the username you want to reset. In this case, I want to reset Cynthia's password, so I type passwd cynthia
You'll then be prompted for a new password. When you type the password you will get no visual response acknowledging your typing. Your password is still being accepted. Just type the password and hit Enter when you're done. You'll be prompted to retype the password. Do so and hit Enter again. Now the password should be reset. Type
reboot
to reboot your computer.
Now that your password is reset, you can boot into normal (not recovery) mode and use Ubuntu as you normally would—only this time, you actually know the password!
MMMMMMMMM,Posted a reply,any good for you?