Ubuntu – How to hide / remove “postgres” user in Ubuntu 14.04

postgresqluser-managementusers

I recently installed postgresql. (I know very little about it, but may try it out at some point.) I noticed that a user named postgres (which I do not recall creating manually) is now listed both on the login screen and in the session menu. Neither the users not the groups commands list postgres or anything like that.

Can I remove that user and give the necessary permission to my primary user account instead (without rendering the package unusable)? Otherwise, can I at least hide it from the login screen and session menu instead? Either way, how do I do it?

Best Answer

Hide a specific user by creating a file in /var/lib/AccountsService/users/ named with the username, in this case: postgres.

$ sudo vim /var/lib/AccountsService/users/postgres

And add the following two lines:

[User]
SystemAccount=true

If it happens that your system dosen't use AccountsService then hide the user by editing the /etc/lightdm/users.conf file and add the username to this line:

hidden-users=nobody nobody4 noaccess postgres

Then restart lightdm (this will restart the current session so be sure to save your work):

$ sudo service lightdm restart