- Hiding user account from login window. — Simple
- Hiding user account from login window and system preferences — Advanced
The simple version hides the user account from displaying in the list of user accounts during the login process. The account can be visible from system preferences as well as /Users. Here is how to achieve this effect:
sudo defaults write /Library/Preferences/com.apple.loginwindow HiddenUsersList -array-add <username_to_hide>
And now you can reboot and the username mentioned above will not appear in the login window. If you want to revert this, you can run the following command
sudo defaults delete /Library/Preferences/com.apple.loginwindow HiddenUsersList
There are multiple ways of achieving a totally hidden user account. This method involves creating a user account which is no longer visible in system preferences, creating a home folder other than /Users and hiding all shared mount points. This is a true ninja account.
Creating a hidden user account with home directory other than /Users
sudo dscl . create /Users/dummy NFSHomeDirectory /var/dummy
sudo dscl . delete "/SharePoints/Dummy's Public Folder"
This command removes the Public Folder share point for the user with the long name "Dummy”