LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Root password (http://www.linuxquestions.org/questions/linux-newbie-8/root-password-776314/)

nvt33 12-17-2009 02:02 AM

Root password
 
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.

Please help my problem....pls.....

Web31337 12-17-2009 02:48 AM

you mean there is no entry like "Debian ... (single-user mode)" in grub?

AngTheo789 12-17-2009 03:35 AM

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.

nvt33 12-17-2009 04:47 AM

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:

# passwd

will prompt you for your new password and will ask you to confirm it to make sure there is no typo



However it dosen't work.

barre 12-17-2009 05:04 AM

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.

http://linuxgazette.net/107/tomar.html

http://www.linuxquestions.org/questi...ssword-755262/

http://www.linuxquestions.org/questi...assword+forgot

AngTheo789 12-17-2009 05:07 AM

Given the fact that it doesn't work in your case, you should try to mount a live-cd or rescue-cd and do it from there.

Web31337 12-17-2009 05:09 AM

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
Code:

openssl passwd -1 <your_pass_goes_here>

evo2 12-17-2009 05:18 AM

Quote:

Originally Posted by nvt33 (Post 3795034)
However it dosen't work.

You listed a number of steps: which step fails?

Evo2.

AngTheo789 12-17-2009 08:45 AM

@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.

pixellany 12-17-2009 09:07 AM

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:
Code:

cd /mnt
mkdir drive
mount /dev/sda1 drive
cd 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:
root::0:0:root:/root:/bin/bash
    ^ (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:
Code:

sed  -i 's/^root:x:/root::/' passwd

estabroo 12-17-2009 06:10 PM

Since you don't have a cd drive you might want to try booting a usb drive (like a flash drive) live distro


All times are GMT -5. The time now is 07:18 PM.