How To Create A Hidden User Account / Comment créer un compte utilisateur masqué

Hide a user account in OS X Yosemite

You can prevent a user account from appearing in the login window in OS X Yosemite by using these steps:.

1. Log in as an admin user.

2. Use this Terminal command, substituting the short account name name of the user you wish to hide for “hiddenuser”:

sudo dscl . create /Users/hiddenuser IsHidden 1

If you later want to show the hidden user, set the user’s IsHidden attribute to 0 like this:

sudo dscl . create /Users/hiddenuser IsHidden 0

You can optionally delete the IsHidden attribute instead of setting it to 0.

Additional Options

You can also move the hidden user's home directory to a place not visible from the Finder, and remove the hidden user's Public Folder share point.

The following command moves the home directory of "hiddenuser" to /var, a hidden directory:

sudo mv /Users/hiddenuser /var/hiddenuser

The following command updates the user record of "hiddenuser" with the new home directory path in /var:

sudo dscl . -create /Users/hiddenuser NFSHomeDirectory /var/hiddenuser

The following command removes the Public Folder share point for the user with the long name "Hidden User”:

sudo dscl . -delete "/SharePoints/Hidden User's Public Folder"

Hide a user account in earlier versions of OS X

There are three ways you can hide a user in versions of OS X earlier than Yosemite.

Set the Login window to display name and password fields

In the Users & Groups preferences pane (Accounts pane in Mac OS X v10.6 and earlier), click Login Options, then select "Display login window as: Name and password".

With this enabled, no user accounts are listed in the Login window.

If changing the Login Window to only display the name and password fields does not meet your needs, then you can use the following steps in this article to hide a user account.

Add users to the HiddenUsersList (advanced)

With Mac OS X v10.4 and later you can hide users from the Login window by adding them to the HiddenUsersList array in the /Library/Preferences/ file. The following command will hide the users "mei" and "anne" from the Login window:

sudo defaults write /Library/Preferences/ HiddenUsersList -array-add mei anne

Note: These users will still appear in the Accounts (Mac OS X v10.6 and earlier) or Users & Groups (OS X Lion) pane in System Preferences.

Lower the user's UID and enable the Hide500Users option (advanced)

You can use the advanced steps below to change a user's UID, adjust their home directory permissions and enable the Hide500Users option. An example user account "tom" is used below.

The following sample Terminal command changes the user tom's UID to 401. Note: Check to make sure the new UID is not in use before making this change.

sudo dscl . -create /Users/tom UniqueID 401

This command adjusts the permissions of the user's home directory: 

sudo chown -R tom /Users/tom/

Enable the Hide500Users option with this command:

sudo defaults write /Library/Preferences/ Hide500Users -bool YES
Cet article vous a-t-il été utile ?
Utilisateurs qui ont trouvé cela utile : 0 sur 0
Vous avez d’autres questions ? Envoyer une demande

0 Commentaires

Veuillez vous connecter pour laisser un commentaire.
Réalisé par Zendesk