Change user on UNIX

Bjoern Schliessmann usenet-mail-0306.20.chr0n0ss at
Thu Mar 20 13:05:58 CET 2008

Giampaolo Rodola' 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.
> I tried to google a little bit about it but I still didn't find a
> solution.

IMHO, the cleanest way from a security perspective would be using
sudo. root can even configure it in a way that you don't have to
type a password.



BOFH excuse #223:

The lines are all busy (busied out, that is -- why let them in to
begin with?).

More information about the Python-list mailing list