查看帮助:man dscl
显示所有用户:dscl . list /users
显示所有组:sudo dscl . -list /groups GroupMembership
添加user到group:sudo dscl . -append /Groups/groupname GroupMembership username
从group中删除user:
sudo dscl . -delete /Groups/groupname GroupMembership username
查看ID
dscl . -read /Users/root PrimaryGroupID
dscl . -list /Users UniqueID
dscl . -list /Groups PrimaryGroupID
创建隐藏用户
sudo dscl . create /Groups/nginx PrimaryGroupID 390
sudo dscl . create /Users/nginx UniqueID 390
sudo dscl . create /Users/nginx PrimaryGroupID 390
sudo dscl . create /Users/nginx UserShell /bin/false
sudo dscl . create /Users/nginx RealName nginx
sudo dscl . create /Users/nginx NFSHomeDirectory /dev/null
sudo dscl . create /Groups/nginx GroupMembership nginx
http://www.ideawu.net/blog/archives/835.html
http://www.l68.net/515.html
http://www.cnblogs.com/whyandinside/archive/2012/04/21/2461483.html