Apple - How to disable account on OS X Mavericks

You can disable a user account by setting their shell to /usr/bin/false.

Either run chsh -s /usr/bin/false <username>, or change it in Users & Groups → Advanced Options. To change it back, run chsh -s /bin/bash <username>.


Changing the login shell does not stop the GUI login, but does stop shell / ssh login.

The answer is given by: https://serverfault.com/questions/61214/how-can-i-disable-a-user-account-from-the-cli-with-mac-os-x-server#new-answer

With details on hiding given by: https://support.apple.com/en-au/ht203998

pwpolicy can both disable and enable users, without losing their password

To disable the user

pwpolicy -u username disableuser

To enable the user

pwpolicy -u username enableuser

Use dscl to hide the user so they don't show on login:

sudo dscl . create /Users/username IsHidden 1 

To show a hidden user

sudo dscl . create /Users/username IsHidden 0 

For Yosemite and newer, you can use

sudo dscl . create /Users/UserName IsHidden 1

Source: https://support.apple.com/en-us/HT203998