=====================================
if you forgot you password for your ubuntu system you can recover using the following steps
Turn your computer on.
Press ESC at the grub prompt.
Press e for edit.
Highlight the line that begins kernel ………, press e
Go to the very end of the line, add rw init=/bin/bash
press enter, then press b to boot your system.
Your system will boot up to a passwordless root shell.
Type in passwd username
Set your password.
===============
boot: Linux init=/bin/sh
This causes the system to boot the kernel and run /bin/sh instead of its standard init. Now you have gained root privileges and a root shell. Since / is currently mounted read-only and many disk partitions have not been mounted yet, you must do the following to have a reasonably functioning system.
# mount -n -o remount,rw /
# mount -avt nonfs,noproc,nosmbfs
# cd /etc
# vi passwd
# vi shadow
(If the second data field in /etc/passwd is “x” for every username, your system uses shadow passwords, and you must edit /etc/shadow.) To disable the root password, edit the second data field in the password file so that it is empty. Now the system can be rebooted and you can log on as root without a password. When booting into runlevel 1, Debian (at least after Potato) requires a password, which some older distributions did not.
It is a good idea to have a minimal editor in /bin/ in case /usr/ is not accessible.Also consider installing the sash package. When the system becomes unbootable, execute
boot: Linux init=/bin/sash
sash serves as an interactive substitute for sh even when /bin/sh is unusable. It’s statically linked, and includes many standard utilities as built-ins.
Solution 2
Boot from any emergency boot/root disk set. If /dev/hda3 is the original root partition, the following will let one edit the password file just as easily as the above.
# mkdir recovery
# mount /dev/hda3 recovery
# cd recovery/etc
# vi shadow
# vi passwd
Scroll down to the line containing the root user’s information, which looks something like
root:weeWRSF!sfDFs:12581:0:99999:7:::
Delete everything between the first and second colons, so that the line looks like
root::12581:0:99999:7:::
Save the file and exit your editor.Type cd to return to your home directory.
Type umount mountplace to unmount the partition.
#unmount /dev/hda3 recovery
Type reboot to reboot your system
The advantage of this approach over the previous method is one does not need to know the lilo password . But to use it one must be able to access the BIOS setup to allow the system to boot from floppy disk or CD, if that is not already set.
Solution 3
Reseting passwords by mounting on another system and editing the password file is bit more work need to be done.first you need to Shut down the machine after backing up all important data.Now remove you machine hard disk and connect this hard disk as slave drive for another machine(this should be linux OS) and boot this machine.Once the system finishes booting, mount the slave drive’s root partition and edit the password file.If /dev/hda3 is the original root partition, the following will let one edit the password file just as easily as the above.
# mkdir recovery
# mount /dev/hda3 recovery
# cd recovery/etc
# vi shadow
# vi passwd
Scroll down to the line containing the root user’s information, which looks something like
root:weeWRSF!sfDFs:12581:0:99999:7:::
Delete everything between the first and second colons, so that the line looks like
root::12581:0:99999:7:::
Save the file and exit your editor.Type cd to return to your home directory.
Type umount mountplace to unmount the partition.
#unmount /dev/hda3 recovery
Type reboot to reboot your system
If you want to prevent others from resetting your root password you can use two options first one is protect your bootloader with password i.e your GRUB or LILO boot loaders and second one is protect BIOS with password.
Tags: forgot root password debian, recover debian root password, reset debian root password, Security
You may also be interested in...
* Enable and Disable Ubuntu Root Password
Print This Post/Page | 15,789 Views | E-Mail This Post/Page | | [link]
4 Responses to “forgot root password or reset root password in Debian”
1. KeNt Says:
January 9th, 2007 at 12:39 pm
Solution 4
boot with livecd (i’m using slackware install)
mkdir /d
mount /dev/hda1 /d
chroot /d
passwd (or passwd root)
type your new password
press Ctrl+Alt+Delete and enjoy
2. Itumeleng motshabi Says:
May 16th, 2007 at 9:54 am
I know I’m just one of those newbie in linux and you don’t have time to update the web page every-time.please show me how to do it with grub as it is the most default bootloader.
thanks for hearing me
3. theo Says:
July 23rd, 2007 at 3:07 pm
Yes you can do it from grub as well:
1. Select the appropriate entry in the grub menu and press ‘e’
2. Select the kernel … line and press ‘e’
3. Append ‘init=/bin/bash’ at the end of line
4. Press ‘b’ to boot
Then you will need to remount the system as rw and use the passwd command to change the pass
4. Rick Says:
February 4th, 2008 at 4:28 pm
Thanks Theo… I’ve added the mount command for the likes of me:
mount -n -o remount,rw /
- Home
- Activities
- Dimensional Control
- Total Angola - KAOMBO
- ENI - Jangkrik
- Iraq Platform
- AL Wasit --HASBAH - ARABIYAH
- Chevron - Gorgon
- Ichthys LNG Project | INPEX
- BP Tangguh
- Saipem Nigeria - Project EGINA
- Saipem Misr Eqypt - Project Zohr
- PHE ONWJ -3D Laser Scanning Surveyor
- FORMOSA 2 - Wind Farm Offshore
- NNG - Wind Offhore
- BP Senegal Tortue
- Software Surveyor
- Hardware Surveyor
- Contact
No comments:
Post a Comment