Tuesday, January 05, 2010

Temporary disable user on Mac OS

This is my first post in this year. Sometimes the Mac computers located in public places. And many people coming there and do their job. But some of them may access administrator password, create own accounts, drop large files on desktop etc. Sure, the computer owner don't like it and ask trusted person to change administrator password and temporary disable such account. You ca ask - Why not simple delete it? The answer - we may not sure is there important files on user desktop. The good strategy to wait a little and if nobody ask - delete it permanently. There is one trick how to do it.

The main idea is to change default user shell to something else. Then we can enable it again, cause all home folder files in place. The methods little different for Leopard (10.5) and Snow Leopard (10.6) I've found that in SL user disappear not only in login screen, but in System Accounts also. So to enable it again in SL is possible via "Directory Service command line utility".  I wouldn't recommend it do by `chsh' utility. It may not affect on "Directory Service database". But you can check. ;)
OK, lets start. First, run System Preferences → System Accounts do `right click' on `bad guy' and change the user shell to /usr/bin/false
Don't forget to click OK.
Sure, you must have administrator right to do that. Now Click OK, and Log Out. You see that `badguy' user disappeared. Now login again and see in System Accounts this banned user. To enable it just do right click and change the shell to user default. That's it.
As for Snow Leopard (10.6) we have to fire up the console and give such command to enable this user from there.
$ sudo dscl . -change /Users/badguy UserShell /usr/bin/false \ /bin/bash
Enter your password and this user will appear in System Accounts again.
Your comments are welcome.

1 comment:

Anonymous said...

That seems not to work on my MacBook and 10.6.8