Re: Remotely disabling a user account

Nathan Sims <[email protected]>
Newsgroups gmane.comp.macosx.admin
Message-ID <[email protected]>
On Jun 1, 2011, at 7:49 PM, Dan Shoop wrote:
> 
> 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

Thanks, Dan. You and others suggested dscl, which worked beautifully. The user account is a local one (as I stated). I'm not an SA but was tasked to disable an account immediately as there was an issue of a person leaving under "less than ideal" conditions, so their access was supposed to be terminated immediately, etc.

By the way, my problem installing ARD remotely (rather, running ARD for the first time after installation) disappeared after I thought to check for software updates. The ARD sw update did the trick (kept it from hanging).

Thanks again.
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.