LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 07-14-2008, 04:05 AM   #1
zazem
LQ Newbie
 
Registered: May 2008
Posts: 9

Rep: Reputation: 0
How I can set the root password to blank?


I lost my root password and i want to set root password to blank in rescue mode.

I am using scientific linux, and I have a problem to locate the encrypted password file.

Can some1 helps?
 
Old 07-14-2008, 04:28 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982Reputation: 1982
you *never* set the password to be blank. you can change it, but never ever leave it blank. the passwords are stored in /etc/shadow but to reset it you would boot into runlevel 1 from your bootloader (just add "1" to the boot command" and use the passwd command once you are automatically logged in as root.
 
Old 07-15-2008, 08:05 AM   #3
zazem
LQ Newbie
 
Registered: May 2008
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks acid_kewpie, I have deleted the encrpted root password in /etc/shadow, and I can log into the system now.
 
Old 07-15-2008, 08:30 AM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 260Reputation: 260Reputation: 260
Quote:
Originally Posted by zazem View Post
I lost my root password and i want to set root password to blank in rescue mode.
If you setup a user with sudo privileges, you could have reset the password. But losing root's password is a good thing, you shouldn't login as root unless absolutely necessary. Setup sudo for the user(s) you want to have root privileges.
 
Old 07-15-2008, 08:52 PM   #5
simonapnic
Member
 
Registered: Jul 2008
Posts: 70

Rep: Reputation: 16
Post

I've been through a similar situation on 1 of my systems.
The simplest way to recover from a lost password is to boot into single user mode.

If you are using LILO, at the LILO boot prompt (graphical LILO users can press Ctrl-x to exit the graphical screen and go to the boot: prompt), enter:
Code:
linux single
This will make you the "root" user without asking for a password. Once the system has booted, you can change the root password using the password command:
Code:
passwd
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 single-mode boot entry (if you have it)
* 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 init=/bin/bash
* press ESC to go back to the parent menu
* press b to boot this kernel
You should be in a root shell shortly.
You'll have to remount your / partition as writable.
Do:
Code:
mount -n -o remount,rw /
Now, open up /etc/shadow with a text editor like nano or vim and remove the hash your root account has.
Example:
root:$1$aB7mx0Licb$CTbs2RQrfPHkz5Vna0.fnz8H68tB.:10852:0:99999:7:::
will become:
root::10852:0:99999:7:::
 
  


Reply


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 to set login and password and root password in suse 10.2 sirius57 SUSE / openSUSE 8 07-24-2007 10:51 AM
change Root Password even if the password in the grub is also set sheelnidhi Linux - General 6 08-30-2006 08:27 AM
What should I do to set root password backpacker Linux - Newbie 1 06-10-2005 04:19 AM
passwd set password to blank - always fantunes Linux - Security 4 07-27-2004 07:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 09:36 AM.

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