Hiding a CLI-only user account in Mac OS X 10.5 Leopard

5 11 2008

A year and a half ago I installed the excellent PostgreSQL via MacPorts, and had to create a user account manually. Annoyingly, this postgres user shows up in the GUI login screen and Fast User Switching menu under Leopard. I found a fix today.

I dug around a few months ago, and found some options to solve this annoyance that I didn’t like very much. Changing the shell to /usr/bin/false works but then you can’t su to postgres. Changing the UID to <500 and enabling the plist option to hide <500 UIDs seems like a kludge. I was looking for a minimally invasive tweak, that would just make it not show up in that menu. Breaking the account so I can't use it the same way, or altering systemwide behavior, seemed drastic given that there are several other system accounts that have the desired behavior.

Today I decided to fix this and looked harder at what dscl would tell me about other hidden accounts. The solution that worked and didn't seem icky to me was this:
sudo dscl . append Users/postgres Password '*'

That sets the password string to *. This allows me to continue to sudo su -l postgres whenever I feel like it, but it isn't shown as an account in the GUI. Hooray!


Actions

Informations

4 responses to “Hiding a CLI-only user account in Mac OS X 10.5 Leopard”

5 11 2008
Alexandre Simard (22:41:17) :

Very useful tip. That postgres user on my login page has always annoyed me. Thank you very much!

20 02 2009
Things that were not immediately obvious to me » Blog Archive » Mac OSX Tip (01:57:24) :

[...] Hiding a CLI-only user account in Mac OS X 10.5 Leopard Share and Enjoy: [...]

20 02 2009
Paul (08:35:57) :

sudo dscl . append Users/postgres Password ‘*’ – won’t work…

sudo dscl . append /Users/postgres Password ‘*’ – will!

(Spot the ‘deliberate’ mistake? ;-) )

But great tip in any case!

Paul

20 02 2009
Paul (08:51:15) :

Sorry – original code will work – but only after you ‘cd /’ first. P

Leave a comment

You can use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>