At 12:25 PM 10/5/01 -0600, Oleg Lebedev wrote:
>I have a script my_script that is run on startup, which has root
>permissions. From this script I want to start postgres script, which is
>owned by postgres (postgerSQL superuser) and has 's' bit set so that it
>executes with postgres priviledges. When I try to run my_script, I get an
>error: postmaster: real and effective userids must match what am I doing wrong?
On many systems, SUID scripts are considered a security hole. On
SysVr4-derived systems, the SUID bit on a script is silently ignored for
that reason. If you're half-interested, go look at all the hoops PERL
jumps through to run SUID PERL scripts.
Anyway, attached is the script I use to start/stop Postgres on a Solaris
2.6 system. Hope it helps. The magic is the "su posgtres -c ..." part.
-crl
--
Chad R. Larson (CRL22) chad@eldocomp.com
Eldorado Computing, Inc. 602-604-3100
5353 North 16th Street, Suite 400
Phoenix, Arizona 85016-3228