List existing group IDs in numerical order to choose an unused one for new group :-
$ dscl . -list /Groups PrimaryGroupID | awk '{print $2}' | sort -nCreate the new group 'newgroup' and assign it an ID :-
$ sudo dscl . -create /Groups/newgroup $ sudo dscl . -create /Groups/newgroup PrimaryGroupID 1000View the new group :-
$ dscl . -read /Groups/newgroup AppleMetaNodeLocation: /Local/Default GeneratedUID: 423AF02C-F053-41E0-ABCD-33127EF9A9CA PrimaryGroupID: 1000 RecordName: newgroup RecordType: dsRecTypeStandard:GroupsList existing user IDs in numerical order to choose an unused one for new user :-
$ dscl . -list /Users UniqueID | awk '{print $2}' | sort -nCreate the new user 'newuser' and assign various attributes :-
$ sudo dscl . -create /Users/newuser $ sudo dscl . -create /Users/newuser UserShell /bin/bash $ sudo dscl . -create /Users/newuser RealName "New User" $ sudo dscl . -create /Users/newuser UniqueID "1000" $ sudo dscl . -create /Users/newuser PrimaryGroupID 1000View the new user :-
$ dscl . -read /Users/newuser AppleMetaNodeLocation: /Local/Default GeneratedUID: 47D6D841-C7F1-4962-9F7E-167E8BFC3A91 PrimaryGroupID: 1000 RealName: Application RecordName: newuser RecordType: dsRecTypeStandard:Users UniqueID: 1000 UserShell: /usr/bashAdd user to existing group :-
$ sudo dscl . -append /Groups/newgroup GroupMembership newuserChange user password :-
$ sudo dscl . passwd /Users/newuser PASSWORD
Комментариев нет:
Отправить комментарий