Create a hidden admin account

For many reason you may want to create a hidden admin account in your system. This account will be hidden from the System Preferences, Login Window, Fast user switching menu and the home folder will not be in /Users. It will be very difficult for a user to know that his account exists. This is an interactive script so it requires you to enter the desire user name and password.


 
To create the configuration script, copy the text below beginning with the line "#Begin Copy" to the line "#End Copy" and paste the text into TextEdit. Before you save the file go to the "Format" and select "Make Plain Text".



### Begin Copy ###
#!/bin/sh
echo Please Enter the Username you want to create
read USERNAME
echo Please Type in the password
oldmodes=`stty -g`
stty -echo
read PASSWORD
stty $oldmodes
sudo dscl . create /Users/$USERNAME
sudo dscl . create /Users/$USERNAME PrimaryGroupID 80
sudo dscl . create /Users/$USERNAME NFSHomeDirectory /private/var/$USERNAME
sudo dscl . create /Users/$USERNAME UniqueID 499
sudo dscl . create /Users/$USERNAME UserShell /bin/bash
sudo dscl . passwd /Users/$USERNAME $PASSWORD
sudo dscl . append /Groups/admin GroupMembership $USERNAME
sudo defaults write /Library/Preferences/com.apple.loginwindow Hide500Users -bool TRUE
sudo defaults write /Library/Preferences/com.apple.loginwindow HiddenUsersList -array $USERNAME
sudo defaults write /Library/Preferences/com.apple.loginwindow SHOWOTHERUSERS_MANAGED -bool FALSE
sudo createhomedir -c -u $USERNAME
sudo SetFile -a V /private/var/$USERNAME
### End Copy ###

 
You save the file and name it createhiddenuser.sh. Now open the Terminal application and type "sudo sh " and the path to the script file. You can also drag the createhiddenuser.sh on to the terminal window and it will enter the path for you.


It will ask you to enter the Desired user name and password. Your done.

Tags

  • Apple
  • Macbook
  • SSD
  • Linux

Categories

  • Hints 83