[Tutor] uid

Joerg Woelke lumbricus@gmx.net
Sat, 15 Sep 2001 14:09:15 +0200


On Sat, Sep 15, 2001 at 12:17:56PM +0200, Hans Gubitz wrote:
> I want to cp a file and extract it to different users. I can do this
> as root, but I want extract  to be done with the uid of the user.
> 
> import os, pwd
> users = ['usera','userb']
> 
> def copy(user):
>         list = pwd.getpwnam(user)
>         #uid = list[2]
>         home = list[5]
>         os.chdir(home)
>         os.system('cp /tmp/file.tgz .')
>         os.system('tar -xzf file.tgz')
> 
> for u in info_1:
>         copy(u)
>             
>         
> ??????        

os.suid()

> -- 
> Hans Gubitz <gubitz@netcologne.de>
> 

HTH und Gruss 
J"o! :-)

-- 
The shortest distance between any two puns is a straight line.