Re. suid/sudo in python

Martin P. Hellwig martin.hellwig at
Mon Mar 30 18:41:38 CEST 2009

Rustom Mody wrote:
I don't think this is necessary a python problem but a generic, SUID 
scripts considered dangerous, problem.

The essence of your program is that you only want information, that is 
great! Since that makes it all a bit simpler.

How about writing a cronjob that outputs the require information into a 
file and then write a separate program that reads the output and 
displays it on the web site when requested?

If you are particular adventurous, your cronjob could check if a certain 
file exists first and then execute the (CPU intensive) script, this is 
especially handy when you expect changes every second or so. I wouldn't 
write that check for file existence in Python though, you don't want to 
fire up an interpreter every second. But a simple sh script will do only 
calling python if it really needs too (perhaps also putting it on an 
appropriate nice level).



More information about the Python-list mailing list