David Gerler wrote:
> How do I make a script run as a specific user.
>
> I am working on a script that uses a pipe to send information to a
> program that outputs to a file. It works on win2000. I have uploaded
> it and it runs and works correctly when run in the debugger from a
> shell with the command "perl -d". The only time it doesn't run is when
> it is called as an action from a form in a browser. The only
> difference that I can find is that when call from the browser it runs
> as "nobody". In the debugger it runs as the login user and works
> correctly.
> When I say that it runs as nobody, I mean that the file output from
> the pipe is owned by "nobody".
> Can anyone shed any light on this? How can I make the file run as my
> user? Alternately, how do I make it chown the file to me. This is on a
> virtual host server.
>
This is a reply to the group rather than just you, but when shopping for
virtual web space, be sure your provider runs a wrapper program like
suEXEC or cgi-wrap or something. Actully, the only wrapper I reccommend
is suEXEC. What this does is change the permissions a script runs as to
the permissions of the script's owner. That way, you can leave your cgi
programs 700 and the text files (and directories) you write to 600. This
secures your data very tightly.
Run this program through a web browser:
#!/usr/bin/perl -w
use strict;
use CGI qw/:standard/;
print header();
print start_html();
print div('Apache user:');
print div('I am:', `id -un`);
print end_html();
And if it says the program runs as anyone other than you, tell your host
that you want suEXEC. If that dosent work, find another host.
Todd W.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]