Welcome to HostingForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

am I running as root? sperl problems

 
   Web Hosting Problem Solving Community! (Home) -> Apache RSS
Next:  Virtual host setup question  
Author Message
alexxx.magni

External


Since: Feb 18, 2008
Posts: 5



(Msg. 1) Posted: Wed Feb 20, 2008 2:20 am
Post subject: am I running as root? sperl problems
Archived from groups: alt>apache>configuration (more info?)

Thanks to the help of this newsgroup, I'm almost there with my setup.

I'm trying to build an application running locally (Listen 127.0.0.1),
and even if I never installed a webserver in my life, after 2 days I
have Apache up&running, and cgi perl scripts (which are the main
application I'm building) working correctly. Almost correctly.

Now comes the big - hopefully last - trouble: I need my main script to
be run as root.

Making the cgi script root suid (http://www.irt.org/articles/js184/
index.htm) stops the script working with "Internal Server
Error ..." (the logs give me a " Can't do setuid (cannot exec sperl)"
error).
So Installed per-suid, solved the " Insecure $ENV{PATH} " error by
cleaning %ENV, and obtained this, with the line printf("<HR>My userid
is $> (%s)<HR>", (getpwuid($>))[0]):

My userid is 0 (root)

yet the successive behavior (a simple my @l=`/usr/bin/locate *.doc`;
print @lWink
shows that the script is not running as root, as it only reports a
couple of files, the same I would find if running as "Apache".

any hint???


thanks1


alessandro

 >> Stay informed about: am I running as root? sperl problems 
Back to top
Login to vote
alexxx.magni

External


Since: Feb 18, 2008
Posts: 5



(Msg. 2) Posted: Thu Feb 21, 2008 1:37 am
Post subject: Re: am I running as root? sperl problems [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

alexxx.magni.RemoveThis@gmail.com wrote:
> Thanks to the help of this newsgroup, I'm almost there with my setup.
>
> I'm trying to build an application running locally (Listen 127.0.0.1),
> and even if I never installed a webserver in my life, after 2 days I
> have Apache up&running, and cgi perl scripts (which are the main
> application I'm building) working correctly. Almost correctly.
>
> Now comes the big - hopefully last - trouble: I need my main script to
> be run as root.
>
> Making the cgi script root suid (http://www.irt.org/articles/js184/
> index.htm) stops the script working with "Internal Server
> Error ..." (the logs give me a " Can't do setuid (cannot exec sperl)"
> error).
> So Installed per-suid, solved the " Insecure $ENV{PATH} " error by
> cleaning %ENV, and obtained this, with the line printf("<HR>My userid
> is $> (%s)<HR>", (getpwuid($>))[0]):
>
> My userid is 0 (root)
>
> yet the successive behavior (a simple my @l=`/usr/bin/locate *.doc`;
> print @lWink
> shows that the script is not running as root, as it only reports a
> couple of files, the same I would find if running as "Apache".
>
> any hint???
>
>
> thanks1
>
>
> alessandro

I'd like to post the way I solved it (although nobody answered! You
lazy guys!)

-) no need to set suid bits with this method, no need to
install suidperl, no need to clean $ENV{PATH}
-) visudo -f /etc/sudoers
add this line :
apache ALL=NOPASSWD:scriptname.pl
and comment:
#Defaults requiretty
-) Then you can call them so:
system('/usr/bin/sudo', 'scriptname.pl');


hope somebody will find it useful...

alessandro

 >> Stay informed about: am I running as root? sperl problems 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Should the apache process running as root ever handle requ.. - Hi, I am running the apache 2.0.40 that comes with RedHat 9. I have noticed that sometimes a log file that is printed out by php code running on the server is created with different permissions than usual -- usually the permissions are: -rw-r--r-- ...

Problems accessing directory in server document root - I unpacked webcalendar and placed it in its own directory under the root html directory (var/www/html). I can read /var/www/html/webcal/index.html but if I try to access /var/www/html/index.php or readme.html I get a 403 access to that file is denied..

Document root on another PC - Hi! Using a windows 2000 Network I have got one PC containing all the documents for the internet. The Apache is installed on another PC and I wanted to set the DocumentRoot to the location at the Doecument Server...it doesn't work this way: DocumentRoot....

Apache as root - I have what seems like a newbie question. But why does the httpd parent (Apache/1.3.28) run as root? Yes, Apache needs to bind to a lower port. But after that, why could the parent not change its uid to, say, that of the nobody user, and accept..

server root - I have check the file permissions for the directories that my files are in, but still the serverroot will only accept one particulare folder.
   Web Hosting Problem Solving Community! (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]