Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to protect PostgreSQL from user with Windows administrator rights?
Like this question but for Postgres.

share|improve this question
There is no direct link between Windows users and Postgres users (there is no "Windows Authentication"). So simply don't tell your Windows administrator the Postgres DBA passwort (of course the Windows administrator can always edit pg_hba.conf so that isn't much protection) – a_horse_with_no_name May 8 '13 at 9:54
So the answer is no. The Windows administrator on the machine that Postgres (or any software) is installed on can do anything to the installed software and thereby get access. – Colin 't Hart May 8 '13 at 9:57
Correct, just like the answer for SQL Server was. Aaron's (accepted answer) sums it up pretty well: "If you don't trust someone, don't give them Windows Administrator rights, period." – a_horse_with_no_name May 8 '13 at 10:02
You can't hide anything from the local administrator. – Remus Rusanu May 8 '13 at 10:31

No, there is no reliable way to prevent the local administrator (or a domain admin with the ability to grant themselves local admin on a machine) from accessing the raw PostgreSQL data files, starting/stopping the server, changing the service account password, changing pg_hba.conf so they can log in to the server, etc.

As stated in the comments, if you don't trust someone don't give them local admin.

Sufficiently strict group policy could be used to make it a lot harder - but in the process would render the local admin account effectively useless. It would be more typical to create accounts that are "nearly admin", ie they have many rights granted to them but are not local admins and are also quite restricted by ACLs and group policy. This is fairly typical in a corporate SOE, but requires advanced Windows knowledge to set up and won't work on a stand-alone desktop.

If you're envisioning some scheme where you install PostgreSQL on a standalone Windows computer - say as part of some application you're distributing - and stop the person who owns the computer from accessing it then you're totally out of luck. No hope. You can slow the user down a bit if you use an embeddable database that supports whole-DB encryption like SQLcipher or SQLite see, but even then a user with a clue and a debugger can still get in sooner or later, even if you try to add anti-debugger features to your application. PostgreSQL doesn't support in-application embedding or whole-database encryption, so if this is what you want you should look elsewhere.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.