commit 8ce918497560992e547a781d5d58c01e8980480b Author: imterah Date: Sat Oct 26 17:09:36 2024 +0000 chore: Upload files. diff --git a/mdm-bypass.sh b/mdm-bypass.sh new file mode 100644 index 0000000..ac2e177 --- /dev/null +++ b/mdm-bypass.sh @@ -0,0 +1,52 @@ +#!/bin/bash +#set -x + +echo "note: Make sure that the data partition is named 'Macintosh HD - Data', and the main partition is named Macintosh HD" +sleep 3 + +# Path to the dscl tool +dscl_path="/Volumes/Macintosh HD - Data/private/var/db/dslocal/nodes/Default" + +echo "Give a username, real name, and password for a new user:" + +printf " - Real username [MDMUser]: " +read realname + +printf " - Username [mdmuser]: " +read username + +printf " - Password [mdmuser]: " +read password + +# Set to default values +realname="${realname:=MDMUser}" +username="${username:=mdmuser}" +password="${password:=mdmuser}" + +dscl -f "$dscl_path" localhost -create "/Local/Default/Users/$username" +dscl -f "$dscl_path" localhost -create "/Local/Default/Users/$username" UserShell "/bin/zsh" +dscl -f "$dscl_path" localhost -create "/Local/Default/Users/$username" RealName "$realname" +dscl -f "$dscl_path" localhost -create "/Local/Default/Users/$username" RealName "$realname" +dscl -f "$dscl_path" localhost -create "/Local/Default/Users/$username" UniqueID "502" +dscl -f "$dscl_path" localhost -create "/Local/Default/Users/$username" PrimaryGroupID "20" +dscl -f "$dscl_path" localhost -create "/Local/Default/Users/$username" NFSHomeDirectory "/Users/$username" +dscl -f "$dscl_path" localhost -passwd "/Local/Default/Users/$username" "$password" +dscl -f "$dscl_path" localhost -append "/Local/Default/Groups/admin" GroupMembership $username + +mkdir "/Volumes/Macintosh HD - Data/Users/$username" + +echo "0.0.0.0 deviceenrollment.apple.com" >> /Volumes/Macintosh\ HD/etc/hosts +echo "0.0.0.0 mdmenrollment.apple.com " >> /Volumes/Macintosh\ HD/etc/hosts +echo "0.0.0.0 iprofiles.apple.com " >> /Volumes/Macintosh\ HD/etc/hosts + +rm -rf /Volumes/Macintosh\ HD/var/db/ConfigurationProfiles/Settings/.cloudConfigHasActivationRecord +rm -rf /Volumes/Macintosh\ HD/var/db/ConfigurationProfiles/Settings/.cloudConfigRecordFound +touch /Volumes/Macintosh\ HD/var/db/ConfigurationProfiles/Settings/.cloudConfigProfileInstalled +touch /Volumes/Macintosh\ HD/var/db/ConfigurationProfiles/Settings/.cloudConfigRecordNotFound + +touch "/Volumes/Macintosh HD - Data/private/var/db/.AppleSetupDone" + +echo "Done. Rebooting in 10 seconds..." +sleep 10 +echo "Rebooting..." +reboot