Home Forums OS X Server and Client Discussion Misc. Delete Snow Leopard User From Single User

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #377090
    andyboutte
    Participant

    Does anybody know how to remove a user in single user mode on a computer running snow leopard. I have a script for leopard and its not working in snow leopard. Thanks.

    #377108
    macinandy
    Participant

    Hi Andy, I have no issues creating or deleting users from the command line using
    dscl . -list /groups GroupMembership | grep testuser
    dscl . -delete /groups/testusersgroups GroupMembership testuser replace testusergroups with group results from first line.
    dscl . delete /users/testuser
    Maybe if you post your script so we can have a look.

    Cheers

    #377115
    andyboutte
    Participant

    Here are my sciprts for 10.5 and 10.4 (I dont have the source)

    [url]http://files.me.com/andyboutte/qlerrq[/url]

    And here is what we used to use before we had the script made:

    10.4
    mout -uw /
    cd /private/var/db/netinfo
    rm -r local.nidb
    rm ../.AppleSetupDone
    cd /Users
    ls
    rm -r username
    shutdown -r now

    10.5
    mout -uw /
    launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist & dscl localhost
    cd /Local/Defualt/Users/
    rm username
    exit
    rm. /private/var/db/.AppleSetupDone
    cd /Users/
    rm -r username
    shutdown -r now

    When I tried what you posted it gave me an error on the second line. I am guessing that I am getting the testusergroup wrong. When you say ‘from the first line’ I am not 100% sure I know what you referring to. Any help would be greatly appreciated. Thanks.

    #377120
    macinandy
    Participant

    Hi again, the dscl . -list /groups GroupMembership | grep testuser line looks for any groups that testuser is a member of.
    so for example dscl . -list /groups GroupMembership | grep admin on a test machine could return

    _appserveradm admin
    _appserverusr admin
    _lpadmin admin
    admin root admin

    so for a user admin the 2nd line
    dscl . -delete /groups/testusersgroups GroupMembership testuser
    should look like
    dscl . -delete /groups/_lpadmin GroupMembership admin
    would delete admin from the group _lpadmin

    Cheers

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.

Comments are closed