Thread: Postgres service user keeps losing password

Postgres service user keeps losing password

From
"Karim Mardhani"
Date:
Hi All:
 
I am having an interesting problem with the user which starts postmaster as service.
 
I am using postgres 8.0.1 as backend to my stand alone windows application.  My installation program installs postgres in silent mode and sets it to start as windows service.  Before installing postgres my installation program creates a user by running following script:
 
net user /add /y postgres mypassword /EXPIRES:NEVER /COMMENT:"PostgreSQL Service Account" /FULLNAME:"Postgres Service Account"
ntrights -u postgres +r SeServiceLogonRight
ntrights -u postgres +r SeNetworkLogonRight
ntrights -u postgres +r SeInteractiveLogonRight
 
 After creating the user the installation program installs postgres as windows service by using following command:
 
msiexec /i postgresql-8.0-int.msi /qb! INTERNALLAUNCH=1 ADDLOCAL=server,psql SERVICEDOMAIN=%COMPUTERNAME% SERVICEPASSWORD=mypassword SERVICENAME=pgdb SUPERPASSWORD=supperpassword PERMITREMOTE=1
 
So this works fine till the end user actually power cycles the PC rather than shutting it down properly from the start menu.  Basically when the windows starts up after the power cycle the postgres service doesn't start.  The error it gives is 1069 "logon failure".  The only way to fix this is to reset the passward for the user "postgres" to "mypassword" and after that every thing works fine till next power cycle happens.  This has been seen on both windows 2000 and windows xp.  Also I can't even use NET USER command to reset the password.  The password must be reset from "users and password" GUI.
 
So the question I have is why a power cycle causes the system to lose the passward for this user?  It doesn't happen to any other user.  There are quite a few other users in the system.  Also why can't "net user" utility be used to reset the password.  Does anybody see any thing obvious with the way installation program creates the user?
 
Any help in this regard would greatly appreciated.
 
Thanks
 
Karim