Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execution of postgresql by a user with administrative permissions is not permitted

Win7. Postgres 9.3.

Every time I type "postgres" in cmd I get this error.

Created a new account without any admin rights and with "Log on as" rights and with correct directory access rights to postgres/data, then I set this account as the "Log on as" in the services menu, but I still get the same error.

update2017: I never found a solution to this.

like image 588
user3761308 Avatar asked Jun 21 '14 12:06

user3761308


2 Answers

For windows do this:

  1. Start cmd.exe (administrator as you are)
  2. Add postgres user: net user postgres your_password /add
  3. Start a cmd.exe using your new postgres account: runas /user:postgres cmd.exe
  4. You can validate you are login correctly using" whoami
  5. Run postgres normally.
like image 112
user3360767 Avatar answered Sep 25 '22 09:09

user3360767


It is not clear from your question whether you are trying to start the Postgres service or "manually" start Postgres without having a Windows service registered.

Since 9.x Postgres does not require it's own Windows user account to run the service. It defaults to use the built-in "Network" account.

To start the Postgres service (if it has been correctly installed), simply use use

net start postgresql-9.3

(the actual name might be different)

If you did not register a Windows service you should start Postgres through pg_ctl.exe not through postgres.exe. pg_ctl.exe will drop any administrative privileges from the process when starting the server.

To start Postgres manually from the commandline use:

pg_ctl -w -D c:\Path\To\The\DataDirectory

assuming that the access rights to the data directory are setup correctly so that the current user has full access to the directory.

If you want to install/create the Windows service manually, you can also do this through the pg_ctl program:

pg_ctl register -N "postgresql-9.3" -D c:\Path\To\The\DataDirectory

Again the access rights to the data directory must be setup correctly.

like image 37
a_horse_with_no_name Avatar answered Sep 25 '22 09:09

a_horse_with_no_name