Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This 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!


  Search this Thread
Old 12-17-2009, 01:02 AM   #1
LQ Newbie
Registered: Dec 2009
Posts: 2

Rep: Reputation: 0
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.....
Old 12-17-2009, 01:48 AM   #2
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
you mean there is no entry like "Debian ... (single-user mode)" in grub?
Old 12-17-2009, 02:35 AM   #3
Registered: Sep 2009
Posts: 110

Rep: Reputation: 24
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.
Old 12-17-2009, 03:47 AM   #4
LQ Newbie
Registered: Dec 2009
Posts: 2

Original Poster
Rep: Reputation: 0
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.
Old 12-17-2009, 04:04 AM   #5
LQ Newbie
Registered: Nov 2009
Distribution: Ubuntu 9.10 62 bit
Posts: 2

Rep: Reputation: 0
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.

Last edited by barre; 12-17-2009 at 04:57 AM. Reason: Found a better link. The first one.
Old 12-17-2009, 04:07 AM   #6
Registered: Sep 2009
Posts: 110

Rep: Reputation: 24
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.
Old 12-17-2009, 04:09 AM   #7
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
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
openssl passwd -1 <your_pass_goes_here>
Old 12-17-2009, 04:18 AM   #8
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,725

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Originally Posted by nvt33 View Post
However it dosen't work.
You listed a number of steps: which step fails?

Old 12-17-2009, 07:45 AM   #9
Registered: Sep 2009
Posts: 110

Rep: Reputation: 24
@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.
Old 12-17-2009, 08:07 AM   #10
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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:
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:
     ^ (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:
sed  -i 's/^root:x:/root::/' passwd
Old 12-17-2009, 05:10 PM   #11
Senior Member
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,126
Blog Entries: 2

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


password, root

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How could normal user obtain root password or change root password ckamheng Debian 18 02-18-2009 10:28 PM
Change my root password in Debian Linux if I have the current password? panseluta Linux - Newbie 2 12-28-2008 02:02 AM
How to retrieve( or reset) root password in Mandrake Linux, as I forgot my password? Reghunath Linux - Software 4 05-08-2008 04:11 AM
Password Recovery in Edubuntu 7.04 - In Terminal, Root Login : su , password : ????? farhannaeem13 Linux - Security 3 11-30-2007 09:59 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:23 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration