Creating a setuid script

Jurgen Defurne defurnj at glo.be
Fri Jul 21 14:11:14 EDT 2000


Hello,

I am busy writing some scripts, which should be setuid root (several
users should be
able to modify the contents of a file, which is under root control).

The main problem is that setuid root doesn't seem to work with a Python
script. If i have
two programs :

rwsr-xr-x .... tu.pl (obviously Perl)
rwsr-xr-x .... tu.py (the same in Python)

then the perl script reports UID and EUID as 0 and 1000 (or reverse,
they are DIFFERENT),
but the Python script reports 1000 and 1000 (a further test to open a
root owned file in
read mode raises an exception).

I haven't been able to locate information about this in the standard
Python documentation,
nor in the FAQ.

Any ideas, anyone ? (I am using Python 1.5.1 on Debian 2.1)

Jurgen Defurne
defurnj at glo.be





More information about the Python-list mailing list