Accessing NetInfo in single user mode

Posted:
in macOS edited January 2014
Does anyone know how to change the password for a user in the NetInfo DB whilst in single user mode?



It appears, from what I understand, the for some bizzarre reason OS X uses NetInfo for user accts when booted normally, but not in single user mode, it uses the /etc/passwd file then! :S



Thanks

Comments

  • Reply 1 of 6
    I think you can still use the niutils, but you might have to start the NetInfo Server daemon... but the better question is why not just boot off the install disk and use the password changer?
  • Reply 2 of 6
    Quote:

    why not just boot off the install disk and use the password changer? [/B]



    I intend to, but I want a backup in case I can't get it to work. I'm doing on a machine which wont boot off my retail CD (firmware too new) so I'd have to use the restore CD that came with the machine and not having done it before I dont know if it will work.



    I'd like to be able to do it from the command line as well.



    does anyone know the syntax for doing it with the niutil command? The man page isnt much help.



    Thanks.
  • Reply 3 of 6
    The niutils are not fun to work with. Usually you use nidump to get everything into a file, change the file and then niload to get the new info in. Technically you can go through with niutil and selectively add or delete information, but that generally requires more intimate knowledge of the structure of things than I like to keep in my head. At one point I know that someone created a command line utility that allowed you to interactively work with a netinfo db, but I don't think it was ever a standard thing.



    Don't look at this as a good way of doing things. Use the CD/DVD.
  • Reply 4 of 6
    dobbydobby Posts: 797member
    you can also use nicl (netinfo command line). Its a bit tricky but you can traverse the trees and delete/modify/add properties and values.

    $ su - (change to root)

    $ nicl / (the / being the root dir for netinfo)

    / > ? to list commands



    Dobby.



    PS. tar up /var/db/netinfo/local.nidb for safe keeping.

  • Reply 5 of 6
    dobbydobby Posts: 797member
    you can also do the following (as root)



    again tar up your local.nidb



    then



    nidump passwd / > x

    edit the info in x

    niload passwd / < x



    albeit you can only delete the password here.



    BTW. I take no responsibility if you trash your system following my instructions as I am doing them of the top of my head.



    Dobby.
  • Reply 6 of 6
    I've often found dscl better than nicl...its often recommended, and I wouldn't get in the habit of using nicl. Most likely, deprecated soon.



    dscl

    man it it you're not sure...



    -j

    ACHDS 10.3, ACTC 10.3
Sign In or Register to comment.