Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Hi..I am a student and i have to find the root password for my Debian system.I have tried the method in which you cancel the GRUB and going through kernel.Somehow it dosen't work.There is also no CD drive.
Assuming that it is your computer and you have full access to the hardware, I suggest to launch a rescue system from install DVD, remount the device with your Debian system in writeable mode, and clear the password for root in the /etc/passwd file. That should allow you to enter the system with a blank password, maybe you will also have to deal with the etc/passwd file, or simply copy the hashed password value for a known password of some other account.
This is how my friend told me:
ed "Recovery Mode" or "Single-User Mode". If this is your case, selecting this menu entry will boot your machine into single user mode, you can carry on with the next part. If not, you might want to read this part.
Using GRUB, you can manually edit the proposed menu entry at boot time. To do so, when GRUB is presenting the menu list (you might need to press ESC first), follow those instructions:
* use the arrows to select the boot entry you want to modify.
* press e to edit the entry
* use the arrows to go to kernel line
* press e to edit this entry
* at the end of the line add the word single
* press ESC to go back to the parent menu
* press b to boot this kernel
The kernel should be booting as usual (except for the graphical splash screen you might be used to), and you will finally get a root prompt (sh#).
Here we are, we have gained root access to the filesystem, let's finally change the password.
2. Changing root password
As root, changing password does not ask for your old password, therefore running the command:
will prompt you for your new password and will ask you to confirm it to make sure there is no typo
Worst case scenario, what I do is install a new copy of Linux and when it asks for a partition, you use most of the drive for your new version. Just leave some for you old program. It tends to do that for you anyway. Then you can access all your data from the the new partition. Only thing is, I'm not sure if you still need your old password or just your new one, 'cuz I used the same one in both cases. I always us the same password. Something real easy and closest to my heart, my cat... OK, so he's dead... So??? So??? "You can do the same thing," he said ambiguously.
Here are a couple of more tips.
AngTheo789: passwords are not stored in /etc/passwd usually. in fact i never seen that. nvt33: what exactly doesn't work?
as suggested by AngTheo789 you can boot from some livecd, mount your volume and edit /etc/shadow manually, taking either known hash or generating one with
@Web31337: Older UNIX/Linux systems did only use /etc/passwd to store passwords. On the other hand you are quite right that these days most such systems use shadow passwords by default. But even so, it is still possible to tweak the system by disabling shadow passwords, and it would be /etc/passwd alone that handles the task.
Booting into single-user mode by editing the grub command should work fine---as someone suggested, tell us where in this process things go wrong----ie exactly what happens.
A variant of one method already mentioned:
Boot from any Linux Live CD, and open a terminal.
Mount the hard drive as follows:
mount /dev/sda1 drive
ls ##You should now be looking at the directory tree for the installed Linux system---if not---go back
(perhaps your installed Linux is on sda2?)
cd etc (NOT /etc---you need to wind up at /mnt/drive/etc----enter "pwd" to verify)
using whatever editor is available, edit** the passwd file so that the root entry looks like this:
^ (removed x between the first two colons)
save the file and re-boot without the CD---you will now be able to log into root with no password required.
**If there is no editor that you are familiar with, you can also do it like so: