[Tutor] Re: Running a process/script as another user

Derrick 'dman' Hudson dman@dman.ddts.net
Fri Jan 31 15:02:22 2003


--2fHTh5uZTiUOsy+g
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Jan 31, 2003 at 12:28:18PM -0500, Jay Dorsey wrote:
| I have a python script that I"m executing via cgi. the process that=20
| exceutes the script doesn't have access to do what I need it to do=20
| (automate some CVS tasks).

I recommend using suexec.  It will run the cgi script as you, instead
of as the web server's uid.

| Is there anyway to switch to a differnet=20
| non-root user so I can execute these commands as the user with the=20
| proper permissions (using os.system())?  This is on a *nix box.

setuid(), seteuid().  (probably in the os module)
Watch out for security holes in your script!

-D

--=20
How to shoot yourself in the foot with Java:
=20
You find that Microsoft and Sun have released incompatible class
libraries both implementing Gun objects. You then find that although
there are plenty of feet objects implemented in the past in many other
languages, you cannot get access to one. But seeing as Java is so cool,
you don't care and go around shooting anything else you can find.
    (written by Mark Hammond)
=20
http://dman.ddts.net/~dman/

--2fHTh5uZTiUOsy+g
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAj461ccACgkQO8l8XBKTpRRPYwCfTAo2qqDZVMukoJ4e9xfjzAHj
vO4AoIwytuC+deiy8XwOPO6V6ZycZ2/9
=xDXC
-----END PGP SIGNATURE-----

--2fHTh5uZTiUOsy+g--