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

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!

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

  1. 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!


Leave a Reply

Your email address will not be published. Required fields are marked *