Restart postgres in php as nobody

From: Linh Luong <linh(dot)luong(at)computalog(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Restart postgres in php as nobody
Date: 2002-01-07 18:04:11
Message-ID: 20020107180411.2C6B11973D1@jamie.edmonton.computalog.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi all,

I don't know if this is do-able but any suggestions would be appreciated.

I have an restart_psql.sh that takes in an argument -F or -S that executes
the start of stop option of postgres.

I am trying to restart postgres with the option -F when running the php
script via browser as nobody. I have exhausted the following possiblities:

1. system("sudo /etc/rc.d/init.d/postgresql stop");
This doesn't do anything because it doesn't display the message the
database is shutting down or in production state
And also in auth.log it is asking for the password because I didn't sudo
on user nobody.

2. I have tried using setuid on the file restart_psql.sh but unfortunately
it doesn't seem to be forcing the execution as root it still show the user as
nobody when I include whoami in the sh file.

3. I have also tried add nobody to the sudoer file but only allowing to
execute a specific command /etc/rc.d/init.d/postgresql. This also didn't
show progres because it is still asking for the password of nobody in auth.log

Does anybody know if this is possible or is there a better way of doing this?

Thanks

--
Linh Luong

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Darren Ferguson 2002-01-07 18:34:54 Re: Restart postgres in php as nobody
Previous Message Jon Lapham 2002-01-07 18:03:31 Re: How to cast a char[] to varchar?