查看幫助:man dsclhtml
顯示全部用戶: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.htmlnginx