I deleted the root user! Help!

starboardman

Registered
I'm using OSX 10.4.3. I was trying to enable root, but somehow it got deleted. I just added root again, but it's not working because I don't remember any of the properties or values that are supposed to be there. Is there is a default set of properties and values for root on pretty much any system, if so what are they? If not, what do I need to do??
 
Just how did you try to enable root ?
Please specify the steps you've taken much more detailed.
 
I used Netinfo Manager, I copied the password from another user to root, and saved it... then , I don't know, I was multitasking and I came back to Netinfo to find that the root user entry was gone!
 
So let me get this straight: because of some foolhardy manipulations in 'Netinfo Manager' you have inadvertently deleted the root user account entry.

1) you can't copy passwords around in 'Netinfo Manager'. If you want to change passwords for normal users use the 'Accounts' prefPane or the 'passwd' command in 'Terminal'

2) in 'Netinfo Mananger' you can en-/dis-able the root account and set/change the password for the root account. This is *all* done from the 'Security' menu

3) the root account entry is almost the same as for a normal user account - it's just lacking some un-neccessary entries. The root account has the following entries (when disabled):
Code:
[10:17:07@Utilities]$ nidump -r /users/root .
{
 "uid" = ( "0" );
  "expire" = ( "0" );
  "home" = ( "/var/root" );
  "shell" = ( "/bin/sh" );
  "gid" = ( "0" );
 "name" = ( "root" );
  "realname" = ( "System Administrator" );
  "change" = ( "0" );
  "_writers_passwd" = ( "root" );
}
4) to re-create the root user entry you can thus simply copy eg your admin acount and change/delete the entries in the copy to correspond to the above.
 
Thanks. Now, whenever I use the command "su root", it works but the user becomes "nobody", it creates "nobody" even if I delete it. How can I actually switch to root?
 
Why even _activate_ the root user in the first place? *sigh* ... You shouldn't login graphically as root, anyway, so...
Code:
Last login: Wed Nov  2 22:08:21 on console
Welcome to Darwin!
frykes-Computer:~ fryke$ sudo -s
Password:
frykes-Computer:~ root# whoami
root
frykes-Computer:~ root#
 
I'm assuming the following:
i) when you use 'su root' you get a prompt somewhat like this:
[computername]:~ nobody#
ii) you've used 'Netinfo Manager' to delete the 'nobody' user.

0) !Please! provide much more detailed problem descriptions. I'm having to make educated guesses as to what you are actually meaning, guesses that might lead me to provide bad, incomplete or falty advise:
a) describe in as much detail as possible the steps you have taken that has led you into trouble
b) if you are seing something abnormal or unexpected, please provide an example of the abnormal behaviour as well as an example of what you expected to see.

1) !!!DON'T!!! delete the special users created by and used by the system. That's the straight way to eventually getting serious problems with your OS - finally leading you to having to reinstall everything from scratch. Look, 'Netinfo Manager' is a program you !!!ONLY!!! mess around with if you are at least 200% sure of what you are doing - or are willing to the the consequenses. To be blunt and frank, you seem to understand neither the special user accounts nor the 'Netinfo Manager'. Normal Mac OS X system administration *doesn't* require *any* interaction with 'Netinfo Manager' at all !!! It's for serious and very, very advanced administration of the system. Normally, you only ever use it to enable the root account - and even that seldomly.

2) nobody has to look like this:
[10:22:33@Utilities]$ nidump -r /users/nobody .
Code:
{
  "name" = ( "nobody" );
  "passwd" = ( "*" );
  "uid" = ( "-2" );
  "gid" = ( "-2" );
  "change" = ( "0" );
  "expire" = ( "0" );
  "realname" = ( "Unprivileged User" );
  "home" = ( "/var/empty" );
  "shell" = ( "/usr/bin/false" );
  "_writers_passwd" = ( "nobody" );
}
!Please! make sure that it does so.

3) under normal circumstances you don't need to switch to the root user. 'sudo' is more than enough and isolates you from most serious mistakes. !Don't! use the root account for normal administration - it's for very serious emergencies only.

4) actually switching fully to root is accomplished with this command:
sudo su - root

5) if the reason for you to want to switch to root is that you are tired of being prompted for the admin password a much better solution is to do as described here: http://fink.sourceforge.net/faq/usage-fink.php?phpLang=en#sudo
 
ACtually, sudo should already be installed with Mac OS X by default. And using the sudo command will alow you to do anything root can do without actually becoming root. The only reason you might need to activate root is if an application (like nmap) needs exclusive root access. There are ports now of nmap for OS X that don't even require you to manually enable to root user...it takes care of that for you.
 
I'm just trying to install gimp2.2 using darwinports... and I have to run "./configure" for the darwinports installation, I keep getting permission denied. ./configure: line 90: conf626.sh: Permission denied
./configure: line 91: conf626.sh: Permission denied
chmod: conf626.sh: No such file or directory
./configure: line 203: conf626.file: Permission denied
./configure: line 993: config.log: Permission denied

That was after using "sudo ./configure". I also tried the ./configure after I used "sudo su - root". I keep getting permission denied.
 
OK - so you are trying to install DarwinPort by compiling it yourself.
They've actually got a *.dmg you can download (even though I haven't tried it since I'm compling DarwinPorts from source myself too because I'm making changes to the default installation)

1) ./configure should *not* require root permission in any of the variations thereof. I don't use it.

2) I want you to state *explicitly* the steps you have taken from the moment of you starting download of the *tar.gz file.

3) steps to successfully get Dawinports installed in '/darwinports' instead of '/opt/local' (it doesn't matter which one you use, but I like '/darwinports' better)

Code:
mkdir -p ~/WebServer/DarwinPorts
cd ~/WebServer/Darwinports

Now save the following in a file called 'darwinports.bash' in the above folder:
Code:
#!/bin/bash

if [ ! -e DarwinPorts-${1}.tar.gz ]
then
    curl -O http://darwinports.opendarwin.org/downloads/DarwinPorts-${1}.tar.gz
fi

export PATH=/Developer/Tools:/bin:/sbin:/usr/bin:/usr/local/bin:/usr/sbin

sudo rm -rf ./DarwinPorts
tar -zxf DarwinPorts-${1}.tar.gz

cd DarwinPorts-${1}
./configure --prefix=/darwinports
make
sudo make install
While still being in the directory above execute the following commands:
Code:
chmod +x darwinports.bash
./darwinports.bash 1.1
export PATH=/darwinports/bin:/darwinports/sbin:${PATH}
sudo port selfupdate
sudo port install gimp2
Modify the above to suit your own needs.
 
Ok, I typed every command in your tutorial up through "sudo port selfupdate". Here's the error I got when I typed that command:
"sudo: port: command not found"
 
1) did DarwinPorts get installed (it would have been nice if you had told whether it had or not)(you've !still! got at lot to learn about reporting pertinent and helpful facts)
2) what does this command yield : ls -al / | grep da.*
3) what does this command yield : echo -e ${PATH//:/\\n} | grep da.*
3) what does this command yield : echo ${SHELL}
 
1) I have no idea if darwinports is installed, I would tell you if i knew.
2)-rw-rw-rw- 1 jordan staff 12292 Nov 3 15:52 .DS_Store
3) /Applications/darwinports/bin
/Applications/darwinports/sbin
3) /bin/bash
 
1) the './darwinports 1.1' should hopefully have written a lot of stuff on the screen and taken about half an hour to finish
2) I'm puzzled as to how you get that result. Are you sure you entered that command *exactly* as written and that you didn't forget the '/'.
3) why is there a '/Applications' before '/darwinports' in the output?. I didn't write that there should be a '/Applications' before them.
2nd 3) that looks right

Now, lets try to troubleshoot it again
0) did you make any modifcations to my procedure on how to install Darwinports ?
1) close the Terminal window you have open and open a new one. that'll reset everything.
2) what does this command yield : ls -al / | grep darwin*
3) execute this command:
export PATH=/darwinports/bin:/darwinports/sbin:${PATH}
4) what does this command yield : which port
 
BjarneDM said:
4) actually switching fully to root is accomplished with this command:
sudo su - root

sudo= super user do and requires an admin level password
or your username must be in the sudoers file.

It gives you limited root priviledges, but does not fully log
you in as the root user.

su= switch user and allows you to login to any account you
have a password for.


sudo su -root is not proper syntax and will not work - if the root user is enabled,
you type in su root or just su and then enter the root password when prompted.
 
starboardman said:
1) I have no idea if darwinports is installed, I would tell you if i knew.
2)-rw-rw-rw- 1 jordan staff 12292 Nov 3 15:52 .DS_Store
3) /Applications/darwinports/bin
/Applications/darwinports/sbin
3) /bin/bash

At this point you know that errors you made in netinfo possibly deleted necessary entries for the root account and possibly the nobody account as well - and you do not know what else may be affected as a result.


An easy way to fix this would be to backup any data you do not want to lose and do an archive and install.
 
g/re/p said:
sudo su -root is not proper syntax and will not work - if the root user is enabled, you type in su root or just su and then enter the root password when prompted.
You are just so wrong.
1) There's nothing wrong with prefixing with 'sudo'; I might be going a little bit far, but it's working. And there is a difference: If you use just 'su' you'll be prompted for the password of the user you want to switch to; if you use 'sudo su' you'll be prompted for your own admin password and not the password of the user. And as I've implemented the 'sudo' trick from the fink page I gave the link to, I'm never ever prompted for my admin password. Thus, for me it's actually an advantage to prefix 'su' with 'sudo'.
2) Try reading the man pages for 'su' and look at the '-l' (or just '-') option. There is a major difference between 'sudo su root' and 'sudo su - root' that you ought to be aware of. And I did write switching fully !
 
g/re/p said:
At this point you know that errors you made in netinfo possibly deleted necessary entries for the root account and possibly the nobody account as well - and you do not know what else may be affected as a result.
The major problems are that he is blundering around in the system like an elephant in an antiques store; and is very bad at giving feed-back; and very bad at following instructions to the letter.

I do think that I've rescued his 'root' and 'nobody' accounts, BUT it would have been very nice to have been told whether or not he has actually done as he has been advised to do. It p*ss*s me off to a certain degree.
 
Back
Top