os.seteuid

Daniel insaney at ufl.edu
Tue May 7 09:33:10 EDT 2002


I'm new at this, so maybe I've just got it all wrong, but I have a
python script owned by root:root with chmod +s.  Should this script be
able to set-uid/gid/euid/egid or anything?  The script fails at
changing any of these to anything else.

Help?
~ Daniel

$ ls -al testing2
-rwsr-sr-x    1 root     root          205 May  7 09:10 testing2
$ cat testing2
#!/usr/bin/python2
import os
print os.getgid(),os.getegid(),os.getuid(),os.geteuid()
print os.getgroups()
os.seteuid(0)
$ ./testing2
48 48 48 48
[48]
Traceback (most recent call last):
  File "./testing2", line 5, in ?
    os.seteuid(0)
OSError: [Errno 1] Operation not permitted

if useful...
running RH linux 7.2... have tried python 2.2 and python 1.5.2
(without print os.getgroups() line)



More information about the Python-list mailing list