0

This is the method in Linux:

groupadd -g 5000 vmail 
useradd -g vmail -u 5000 vmail -d /var/mail

How is it done in OS X?

1 Answer 1

2

Found the answer that works from in a 4 year old post on this board. This creates the user, and the group, with the specific gid.

dscl . -create /Users/vmail UniqueID 5000 PrimaryGroupID 5000 RealName "vmail"

It can be checked, because it runs silently, with the following. The command in my case gives the following output.

bash-3.2# dscl . -read /Users/vmail UniqueID
UniqueID: 5000 PrimaryGroupID 5000 RealName vmail
bash-3.2# 

Ok, for some reason it doesn't actually add a the group - so you have to go into the GUI, System->preferences->Users/Groups and add the group, and set it's UID at the top, to 5000 - then it all works

1
  • I had to use sysadminctl -addUser <username> -fullName <fullname> -password <password> -admin first and then used dscl . -create /Users/<username> UniqueID 5000 to set the uid. Inspired by this answer Nov 8, 2017 at 8:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .