Adding Netinfo User via Terminal

Posted:
in Genius Bar edited January 2014
I stupidly deleted the user "nobody" thinking an external program had added it. I found out it is part of OS X's standard users. Is there a command line way to add it back? I know it was a dumb mistake, but I could use some help

Comments

  • Reply 1 of 2
    dobbydobby Posts: 797member
    Do this.

    open terminal and su - root (you can sudo each and every command if you want).

    cd /var/db/netinfo

    tar cf local_nidb.tar local.nidb

    cd (takes you home)

    copy the next line(s) to a tmp file say nobody.txt

    nobody:*:-2:-2::0:0:Unprivileged User:/var/empty:/usr/bin/false

    (it should all be on one line)

    now comes the tricky part

    nidump passwd / |grep nobody (just to make sure nobody really isn't there)

    niload passwd . < nobody.txt (adds nobody back to the user list)

    nidump passwd / |grep nobody (check its there).



    This worked on my test box.

    Edit: No responsibility taken it your system hoses itself.



    Dobby.
  • Reply 2 of 2
    mcsjgsmcsjgs Posts: 244member
    Thanks fo your help, dobby, but another user in a different Unix forum showed me this:



    echo "nobody:*:-2:-2::0:0:Unprivileged User:/var/empty:/usr/bin/false" | sudo niload passwd .



    which worked. Appreciate you taking the time though.
Sign In or Register to comment.