Change user on UNIX

Jeff Schwab jeff at schwabcenter.com
Thu Mar 20 11:16:05 EDT 2008


Jonathan Gardner wrote:
> On Mar 20, 4:51 am, "Giampaolo Rodola'" <gne... at gmail.com> wrote:

>> Is there any way to su or login as a different user within a python
>> script? I mainly need to temporarily impersonate another user to
>> execute a command and then come back to the original user.

> In the unix world, this is highly discouraged. You shouldn't have to
> change your user.

> If you want a different user to access files that another user
> created, that's what groups are for.

What's your take on setuid scripts (Python or otherwise)?  I more or 
less agree with your assessment of su, so I would be interested in your 
opinion of chmod ug+s some_custom_script.



More information about the Python-list mailing list