Hi guys

I am writing some Perl scripts. I was facing a problem. Fortunately, I have found a 
workaround. But I am interested to know if there can be a better solution.

Problem was: The scripts are running not as root user (and this can't be changed). But 
at some places I want to do operations that require root privilege. the operations are 
of two types (1) reading and writing to files that are owned by root and (2) executing 
commands (for example, postcat) that require root privilege. I have no idea how this 
can be done in Perl. The workaround that I have managed is, I have created binary 
executable files using C.
I invoke the binary executable file from perl script. In C code, I do
  suid (0);
This gives root privilege and then I do whatever operation is required. But I have to 
set suid bit on for the binary executable file using chmod u+s <filename>  Also, that 
file must be owned by root. I am concerned about security.
Does anyone know a better solution? Kindly enlighten me upon this.

Thanks in advance
Yogesh

-- 
India.com free e-mail - www.india.com. 
Check out our value-added Premium features, such as an extra 20MB for mail storage, 
POP3, e-mail forwarding, and ads-free mailboxes!

Powered by Outblaze
--
______________________________________________________________________
Pune GNU/Linux Users Group Mailing List:      ([EMAIL PROTECTED])
List Information:  http://plug.org.in/mailing-list/listinfo/plug-mail
Send 'help' to [EMAIL PROTECTED] for mailing instructions.

Reply via email to