Create Administrator account in Single-Mode

  1. Using ⌘+S to boot into Signle-Mode
  2. Execute following command
  3. Reboot or Type `exit` to boot into login window
Command:

/sbin/fsck -fy
/sbin/mount -uw /
launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist
dscl . -create /Users/hiddenuser
dscl . -create /Users/hiddenuser UserShell /bin/bash
dscl . -create /Users/hiddenuser RealName "Hidden User"
dscl . -create /Users/hiddenuser UniqueID "401"
dscl . -create /Users/hiddenuser PrimaryGroupID 20
dscl . -create /Users/hiddenuser NFSHomeDirectory /var/hiddenuser
dscl . -passwd /Users/hiddenuser password
dscl . append /Groups/admin GroupMembership hiddenuser
ref1: http://apple.stackexchange.com/a/230780
ref2: https://managingosx.wordpress.com/2006/09/15/add-a-user-to-the-admin-group-via-command-line-20/

留言

熱門文章