Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remove user from group Mac Os X (El Capitan)

Tags:

bash

shell

macos

I'm trying to remove myself from the groups _developer and procmod where I accidentally added it with the following commands:

sudo dseditgroup -o edit -a marinos -t user _developer
sudo dseditgroup -o edit -a marinos -t user procmod

when I id I get this:

uid=501(marinos) gid=20(staff) groups=20(staff),401(com.apple.sharepoint.group.1),9(procmod),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),204(_developer),502(access_bpf),33(_appstore),100(_lpoperator),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh)

to remove I've tried

sudo dscl . -delete /Groups/_developer GroupMembership marinos

and I get this error

<main> attribute status: eDSAttributeNotFound
<dscl_cmd> DS Error: -14134 (eDSAttributeNotFound)

and this sudo dscl . -delete /Groups/procmod GroupMembership marinos which results in no error but does not remove me from the group - id returns the very same groups as before.

I've also tried:

sudo dseditgroup -o edit -u marinos -d procomod user procmod

and I get

Group not found.

and this:

sudo dseditgroup -o edit -u marinos -d procmod user procmod

which results in no errors but has no effect either.. id still shows that I'm a member in all these groups..

please help... I'm desperate

like image 586
Marinos K Avatar asked Mar 13 '23 04:03

Marinos K


1 Answers

The correct way of removing a user from a group is using the GUID instead of the username:

dscl . -delete /Groups/<group> GroupMembers <GUID>
like image 187
Istvan Avatar answered Mar 21 '23 11:03

Istvan