Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Remove Unix user named postgres after complete uninstallation of postgresql

I’m running MX Linux 21 and recently installed PostgreSQL-13; I wanted postgres to have read, write and execute access to a certain folder therefore I added the unix user postgres to the group of owner and granted such accesses to the group. The commands was: setfacl -R -m u:postgres:rwx myfolder

Then I uninstalled postgresql from MX package manager completely (i.e., sudo apt remove postgresql-13).

I thought the unix user called postgres should be gone with the removal of postgresql, it however was not the case. I am still able to do sudo su postgres and logged in as the user postgres.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I then did sudo deluser postgres and it failed with exit code 8, saying there’s process still running on postgres.

I then did a ps -ef and found that sudo su postgres is the main process that held up the deletion of user postgres. I killed that process in htop and ran sudo deluser postgres again with success.

But when I checked with getfacl to see if the unix user postgres has been deleted from the user group, I found this:

$ getfacl myfolder
# file: owner
# owner: owner
# group: owner
user::rwx
user:121:rw-
group::rwx
mask::rwx
other::r-x

That user:121 is in place of user postgres.
Does this mean installing postgres is leaving a trace in my system and I can’t purge it?
Does this mean installing postgres would always make an user postgres in my system and if I don’t delete it, it’ll be there forever?

>Solution :

Does this mean installing postgres is leaving a trace in my system and I can’t purge it?

apt remove deletes what is installed from the package, but not files created such as configuration or databases. apt purge postgresql-13 should get those. As a last resort, you can delete the files manually.

See https://askubuntu.com/questions/231562/what-is-the-difference-between-apt-get-purge-and-apt-get-remove

even if I managed to delete the user postgres, there’s a user:121 in my system

There is no user:121, there are only files and directories owned by user ID 121 which may or may not exist. postgres was user 121.

Run users to see the users on your system.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading