Re: Remotely disabling a user account

Dan Shoop <[email protected]>
Newsgroups gmane.comp.macosx.admin
Message-ID <[email protected]>
On May 31, 2011, at 2:41 PM, Nathan Sims wrote:

> I have a situation where I need to disable a user account on a remote iMac using commands issued from a Terminal window. What would be a good approach to doing this? The user account is local to the machine. (Normally I would use ARD, but it locks up when I try to install it remotely.)


ssh in, and as root or with sudo use passwd to change their password to something else. This presumes you just want to prevent them from logging in. 

This is covered in the Mac OS X Server Command Line Administration Guide, part of the documentation. You may want to RTFM. See http://manuals.info.apple.com/en/command%5Fline%5Fadmin%5Fv10.5.pdf

You've not stated your OS X version or whether the user is a local account or a network user (one in LDAP also confused with an Open Directory user, in reality all users are in Open Directory regardless of datastore.) 

For Leopard and Snow Leopard (OS X 10.5 & 10.6) and network / LDAP users:

   pwpolicy -a diradmin -u ajohnson -setpolicy "isDisabled=1"

For local users

   sudo dscl . -create /Users/ajohnson UserShell /usr/bin/false

-d

------------------------------------------------------------------------
Dan Shoop
[email protected]
GoogleVoice: 1-646-402-5293
aim: iWiring
twitter: @colonelmode
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.