[BlueOnyx:11439] Need CGI script to execute command as root

David Thacker David at ThackerNet.com
Thu Sep 27 21:19:06 -05 2012


Greetings,

I am about 98% done migrating sites from a RaQ4 to BX 5107, and most 
things are working right on the new server. But...

I had a web form and CGI script on the RaQ4 that I used to make file 
downloads available to customers via a special URL. The files exist 
outside of the /home/sites tree and the CGI script worked by creating a 
symbolic link in the web space pointing back to the actual file outside of 
the web space.

This script ran as root on the RaQ4 because it needed to use the "symlink" 
and "unlink" commands to do its thing. The html form and the CGI script 
were placed inside the admserv space, so one needed to use the server 
admin user and password to actually get to the form. This was fine because 
I am the server admin and it kept everyone else out.

Specifically, the linkman.html form was placed in the 
/usr/admserv/html/.cobalt/utils folder, and the linkman.cgi was in the 
/usr/admserv/cgi-bin/.cobalt/utils folder, chmodded 0755.

The form was accessed (requiring server admin login) via this URL:
http://www.example.com:81/.cobalt/utils/linkman.html


What's the best way to reproduce this behaviour on the BX server?

1. When I put the form and CGI (modified for correct paths) into a regular 
vsite web folder (thinking I'll add an .htaccess login once I get it 
working), owned by the siteadmin, the CGI fails because it cannot execute 
those "symlink" and "unlink" commands that require admin/root.

Can I fix this using sudo in my script, or some other method?


2. When I try to stuff the html and CGI into a folder together under 
/usr/sausalito/ui/web instead (thinking that is the admserv web space), 
owned by root, when I post the form the CGI script is just displayed in 
the browser instead of being executed.

Can I fix this somehow so that the CGI script is run rather than being 
shown in the browser?


Any ideas?

Thank you,

David Thacker




More information about the Blueonyx mailing list