Force ID of user created by apt-get
- by Bart van Heukelom
Context:
I'm automatically installing postgresql-9.1 on an Ubuntu server with apt-get. This creates the required postgres user.
The Postgres data is on an external volume that survives reinstalls. This data is obviously owned by the postgres user.
The problem I'm having is that the ownership is not recorded under the name postgres, but under the UID that postgres had at creation time. When the server is reinstalled, postgres sometimes gets a different UID, and no longer owns the data directory, and thus does not work.
Question:
Can I force the UID of the user postgres created by apt-get to something fixed? Or is there another way to solve my problem?
(As you may have deduced, this is on Amazon EC2 with the data on an EBS volume)