LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 07-06-2008, 11:52 PM   #1
saranrajk
LQ Newbie
 
Registered: Jul 2008
Posts: 1

Rep: Reputation: 0
"Unfortunately"


im using RHEL4 unfortunately i deleted root user and its password.Can anyone pls help me to create root at the time of OS booting?
 
Old 07-07-2008, 12:51 AM   #2
indeliblestamp
Member
 
Registered: Feb 2006
Distribution: Fedora
Posts: 341
Blog Entries: 3

Rep: Reputation: 40
Hmm, I'd recommend booting with a LiveCD and mounting your root parition. Chroot into it, and you might get a prompt that says 'I have no name!'. The steps are:
Code:
mkdir /tmp/temproot
mount /dev/sda1 /tmp/temproot (where sda1 is where your / partition is installed)
chroot /tmp/temproot
Edit /etc/passwd and add a line on top like this (or make sure it exists):
Code:
root:x:0:0:root:/root:/bin/bash
Chroot in again and hit 'passwd root' and you should be able to set a new password for root now.
I've done this when I've lost root password but not when the root user itself has been deleted. But these steps should work by and large.

Last edited by indeliblestamp; 07-07-2008 at 12:54 AM. Reason: minor edits
 
Old 07-07-2008, 01:25 AM   #3
Vit77
Member
 
Registered: Jun 2008
Location: Toronto, Canada
Distribution: SuSE, RHEL, Mageia
Posts: 132

Rep: Reputation: 17
How have you done it? Just removed these lines from files passwd and shadows? Or may be disabled it?
If you can boot in single user mode, it'll be possible to edit them again, or use command useradd.

If not, it could be recommended to reinstall the system. Especially, if you have made some other mistakes like that.
I suppose, there is no critical information on the box?
 
Old 07-07-2008, 02:13 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Another solution:
Boot into "single-user" mode.

When the GRUB menu appears, hit any key to stop the countdown, "e" for edit, then select the kernel line and "e" for edit again. Add the work "single" (no quotes) at the end of the line, and then boot. You will be logged in as the root user with no password needed. Then set your password using the "passwd" command, and re-boot.
 
Old 07-09-2008, 01:32 AM   #5
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
Quote:
Originally Posted by pixellany View Post
...You will be logged in as the root user with no password needed...
I didn't try this, but that looks like a wide open door to capture a system. Getting logged in as root with no password needed ... isn't that the dream of every hacker in existence? What am I overlooking?

Last edited by JZL240I-U; 07-09-2008 at 01:33 AM.
 
Old 07-09-2008, 02:07 AM   #6
indeliblestamp
Member
 
Registered: Feb 2006
Distribution: Fedora
Posts: 341
Blog Entries: 3

Rep: Reputation: 40
Quote:
Originally Posted by JZL240I-U View Post
What am I overlooking?
I guess its the fact that you need physical access to the machine if you want to switch runlevels at boot time. If a bad guy is sitting in your house or office server room, your data is pretty much completely compromised anyway (he could just take the hard disk out, for instance).
 
Old 07-09-2008, 02:28 AM   #7
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
Quote:
Originally Posted by arungoodboy View Post
...If a bad guy is sitting in your house or office server room...
Sure. But it also means any user in a firm can become root (if (s)he has physical access -- but nobody controls all situations). This is no problem for me, but were I administrator I think I'd like to disable that "feature".
 
Old 07-09-2008, 02:37 AM   #8
indeliblestamp
Member
 
Registered: Feb 2006
Distribution: Fedora
Posts: 341
Blog Entries: 3

Rep: Reputation: 40
Ya that's true. I dunno about Lilo but I think you can set a password in grub to prevent random people from fiddling with boot time arguments. Now if you forget that password too..
 
Old 07-09-2008, 02:47 AM   #9
AceofSpades19
Senior Member
 
Registered: Feb 2007
Location: Chilliwack,BC.Canada
Distribution: Slackware64 -current
Posts: 2,079

Rep: Reputation: 58
Quote:
Originally Posted by JZL240I-U View Post
Sure. But it also means any user in a firm can become root (if (s)he has physical access -- but nobody controls all situations). This is no problem for me, but were I administrator I think I'd like to disable that "feature".
Thats why you only let certain people in the server room and/or have a bootloader password
 
Old 07-09-2008, 04:07 AM   #10
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629

Rep: Reputation: Disabled
Quote:
Originally Posted by AceofSpades19 View Post
...have a bootloader password
That's an acceptable solution . There may always be situations, where access to the server room is not as restricted as designed, but a password for GRUB -- fine. Thanks all.
 
Old 07-09-2008, 06:09 AM   #11
mrrangerman
Member
 
Registered: Oct 2007
Location: MI
Distribution: Debian Slackware
Posts: 528

Rep: Reputation: 59
Quote:
pixellany

Another solution: Boot into "single-user" mode.
When the GRUB menu appears, hit any key to stop the countdown, "e" for edit, then select the kernel line and "e" for edit again. Add the work "single" (no quotes) at the end of the line, and then boot. You will be logged in as the root user with no password needed. Then set your password using the "passwd" command, and re-boot.
This may work for the Ubuntu's (haven't tried it yet) but I know on my Debian systems I am still prompt for a root passwd or Ctrl + D to continue.
 
Old 07-09-2008, 09:17 AM   #12
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally Posted by pixellany View Post
Another solution:
Boot into "single-user" mode.

When the GRUB menu appears, hit any key to stop the countdown, "e" for edit, then select the kernel line and "e" for edit again. Add the work "single" (no quotes) at the end of the line, and then boot. You will be logged in as the root user with no password needed. Then set your password using the "passwd" command, and re-boot.
Usually by default on RHEL, single user will prompt for root's password, added security so people can't login when they have physical access to gain root access.

The other way around this is to boot by adding this to the grub line: init=/bin/bash

Instead of using single user mode.
 
Old 07-14-2008, 02:08 PM   #13
shridhar005
Member
 
Registered: Jul 2008
Posts: 90

Rep: Reputation: 17
Angry

Please give appropriate name to your thread.

 
  


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
net working eth0 eth1 wlan0 "no connection" "no LAN" "no wi-fi" Cayitano Linux - Newbie 5 12-09-2007 07:11 PM
Standard commands give "-bash: open: command not found" even in "su -" and "su root" mibo12 Linux - General 4 11-11-2007 10:18 PM
"Xlib: extension "XFree86-DRI" missing on display ":0.0"." zaps Linux - Games 9 05-14-2007 03:07 PM
LXer: Displaying "MyComputer", "Trash", "Network Servers" Icons On A GNOME Desktop LXer Syndicated Linux News 0 04-02-2007 08:31 AM
Any way to get "Alice"; "Call of Duty" series and "Descent 3" to work? JBailey742 Linux - Games 13 06-23-2006 01:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:47 PM.

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