Running subshells under setuid

czrpb nanotech at europa.com
Wed Feb 12 19:09:38 EST 2003


All:

I found the following in the bash man page:

    If the shell is started with the effective user (group) id not
    equal to the real user (group) id, and the -p option is not
    supplied, no startup files are read,  shell  functions  are
    not inherited from the environment, the SHELLOPTS variable, if
    it appears in the environment, is ignored, and the effective
    user id is set to the real user id.  If the -p option is
    supplied at invocation, the startup behavior is the same, but
    the  effective  user  id  is  not reset.

Is there something similar w/ python?

-- Quentin

--- In python-list at yahoogroups.com, czrpb <nanotech at e...> wrote:
> All:
> 
> I have the following Python script being run by a setuid binary:
> 
>     import os,pwd
>  
>     s="uid: %s, euid:
%s"%(pwd.getpwuid(os.getuid())[0],pwd.getpwuid(os.geteuid())[0])
>     print ">>>",s
>     os.system("rsync -v --progress setuid.c dog")
> 
> In short, rsync is basically copying the local 'setuid.c' file to
the file 'dog'. In tsch and perl after this rsync cmd 'dog' is owned
by uid of the setuid binary. Not with python -- the owner is the
person executing the setuid binary, in other words 'dog' gets the
ownership of the real-uid and not the effective-uid.
> 
> What am I missing??
> 
> thanks!! -- Quentin







More information about the Python-list mailing list