PDA

View Full Version : How does one start netinfo while in single user mode?


hschickel
02-26-2002, 01:07 AM
How does one start netinfo while in single user mode?

If that is impossible - is it possible to enable root from the command line if it has not been enabled via netinfo previously? If so how is that done? How does one set or change the password?

Thanks,
Hugh

mervTormel
02-26-2002, 01:31 AM
in single user mode, you are root.

to modify the filesystem, you would have to mount it.

/sbin/mount -uw /

then there command line utilities to netinfo

netinfod(8) - NetInfo daemon
nibindd(8) - NetInfo binder
nicl(1) - NetInfo command line utility
nidomain(8) - NetInfo domain utility
nidump(8) - extract text or flat-file-format data from NetInfo
nifind(1) - find a directory in the NetInfo hierarchy
nigrep(1) - search for a regular expression in the NetInfo hierarchy
niload(8) - load text or flat-file-format data into NetInfo
nireport(1) - print tables from the NetInfo hierarchy
niutil(1) - NetInfo utility


there could be a command to enable root and to change the password.

i don't know if the netinfo daemon would need to be started first.

there's docs at apple KB about some of this.

hschickel
02-26-2002, 01:41 AM
I seem to have fried the netinfo entry for /groups/admin. This of course takes me off the sudoers list so now while in multiuser mode I can't sudo or su to root to fix the problem from my backup.

I never enabled root so I can't login as root and fix the problem that way. If there is a way to enable root from the command line I see this as the most promising fix. Then I could restart, login as root and repair the db.

If I boot into single user mode the netinfo utilities don't seem to do anything. I assume that's because the netinfo database is not up and running - leaving me in the cold again.

I'm currently searching through Apple's KB articles to no avail. Amazingly I've fried OSX over 4 lines of code.

Any help appreciated,
Hugh

mervTormel
02-26-2002, 02:00 AM
i'm surprised you can't su to root.

"Only users in group ``wheel'' (normally gid 0), as listed in /etc/group,
can su to ``root''."

you are in group wheel also?

% id
uid=501(merv) gid=20(staff) groups=20(staff), 0(wheel), 80(admin)

or was that something that i added thru netinfo mgr?

but, why can't you add/patch the admin group thru netinfo mgr?

hschickel
02-26-2002, 02:08 AM
Yes - I'm also in wheel. And frankly, I always assumed that that was the source of the sudoers file.

I've fried the entire entry for /groups/admin in the netinfo db. This has the effect of:

1. I cannot enable root from NetInfo Manager.
2. I cannot su to root.
3. I cannot sudo to root.

I believe that this means I should not be able to enable root from multiuser mode (I'm being treated as a staff member). That would make sense as a security precaution.

nicl seems to have a create property mode (raw) that I'm looking through. It looks more complex than the simple niload which is unavailable because netinfo is not running. I recall reading somewhere that it is possible to start netinfo from single user mode. I'm trying to find the source. I just read it within the last week or so.

Thanks always for your help merv,
Hugh

ps - I need the machine tomorrow morning so I'm hoping to solve this soon.

hschickel
02-26-2002, 02:55 AM
This solution was much like the flying adage, "Any landing you can walk away from is a good one." I'm sure there is a better way to get the required 4 lines back into the database than this (which requires reimporting all changes, users and groups) but I needed a solution fast.

Steps to nuking your netinfo database:

1. Boot into single user mode.
2. Enter the following at the prompts:
cd /private/var/db
rm .AppleSetupDone
cd netinfo
rm -rf local.nidb
exit
3. At the Apple setup screen re-enter your data for one of your users.
4. If you're locked out of your files you have a permissions / uid problem. Fix it from the terminal by entering sudo chown -R user /Users/user where user is the user shortname. If you have only one user this step will not be necessary. If you have more than one you will most likely need to do this to reset the permissions to the uid.
5. Logout and login.
6. Repair or restore the rest of the database.

Hugh

hschickel
02-26-2002, 07:33 AM
Contents of the sudoers file located at /etc/sudoers: # sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root ALL=(ALL) ALL
%admin ALL=(ALL) ALL
It seems to be based on the admin user verses the wheel group. This is interesting.

Hugh