System running: Mandrake Linux v9.1, Webmin 1.080
(tarball), PostgreSQL v7.1.3 (tarball)
The basic bug is that although the "Administration
login" field is set to user "postgres" by default,
webmin still tries to start the database as root (which
is by default not allowed by postgresql).
To replicate the bug:
#Install postgres
#login as root and chown the dir to postgres
su -
chown /usr/local/pgsql postgres. * -R
#change to user postgres
su - postgres
#initalize the db
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
# -D in all instances defines the postgres data location.
#start the db with logfile pg.log
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data
start -l /usr/local/pgsql/pg.log
#setup webmin with /usr/local/pgsql as the base directory
#read the log to see what webmin does when it stops /
starts
tail -f /usr/local/pgsql/pg.log
#in webmin, stop, then start the postgresql server. It
won't start.
To fix the bug:
I don't know perl, so I can't help you out there, but
the command that should be run (if you want to start /
stop / initialize db) as user postgres is something
like this:
start:
su -l postgres -s /bin/sh -c
"/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data
start -l /usr/local/pgsql/logfile"
#In this case, I use logfile "logfile" instead of "pg.log".
stop:
su -l postgres -s /bin/sh -c
"/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data stop"
initdb:
su -l postgres -s /bin/sh -c
"/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data"
That's it. Thanks for webmin, Jamie. It rocks.
Steve
Logged In: YES
user_id=714587
I meant to say I'm using v7.3.2 of PostgreSQL. Oops.
Logged In: YES
user_id=129364
On operating systems that don't come with a PosgreSQL
package and proper startup scripts (like Solaris), the start
command is actually just like that. If you compile it yourself,
you may need to adjust the Module Config to include su
postgres in the startup command. Webmin doesn't do this
automatically, because often the startup command is
something like /etc/init.d/postgres start which includes an
su command in the script.
Logged In: YES
user_id=714587
"Webmin doesn't do this automatically, because often the
startup command is something like /etc/init.d/postgres
start which includes an su command in the script."
That's just my point -- webmin won't start postgres as user
"postgres" (or whatever is put in the field) unless the run
command is actually in /etc/rc.d/init.d/
No matter what you put in there, start as postgres, root or
whatever, it tries to start it as root.
And if its going to run the su command in the etc script ...
then why bother having a field for user at all?
I don't know enough about Webmin as to suggest a more
detailed alternative, but couldn't it run a cmd similar to
the etc one, to ensure that it does start the db as the
correct user?