Change user on UNIX
Jeffrey Froman
jeffrey at fro.man
Thu Mar 20 11:12:51 EDT 2008
Giampaolo Rodola' wrote:
> I mainly need to temporarily impersonate another user to
> execute a command and then come back to the original user.
If the script is run as root, you can freely impersonate other users with
the os.seteuid() and os.setegid() methods.
If the script is not run as root (either directly or through sudo, as
suggested by other posters), then perhaps it should be.
Jeffrey
More information about the Python-list
mailing list