[Tutor] CGI with python question

Kalle Svensson kalle@gnupung.net
Sat, 3 Mar 2001 15:58:03 +0100


--tKW2IUtsqtDRztdT
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Sez Pedro Diaz Jimenez:
[snip]
> Considering this, I planned my cgi to do the following:
>   - The script is initially suid root
[snip]

I don't think this is possible with apache.  Others may be able to correct =
me.

> I've also been playing with suid python scripts, but I wasn't able to mak=
e=20
> the perform root privileged actions. Example:
[snip]
> What I'm doing wrong?

Python scripts can't be setuid on linux.  To get a setuid script, you'll
have to make a C wrapper.  A simple example:

#include <unistd.h>

int main(int argc, char *argv[], char *envp[])
{
    execve("your_python_script.py", argv, envp);
}

Peace,
  Kalle
--=20
Email: kalle@gnupung.net     | You can tune a filesystem, but you
Web: http://www.gnupung.net/ | can't tune a fish. -- man tunefs(8)
PGP fingerprint: 0C56 B171 8159 327F 1824 F5DE 74D7 80D7 BF3B B1DD

--tKW2IUtsqtDRztdT
Content-Type: application/pgp-signature
Content-Disposition: inline

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

iD8DBQE6oQZ7dNeA1787sd0RAgjoAJwOrt46iyZgM6Ew375NJFA9Gj71lACgqRNN
+Ijezfm332mE0KZ2ePC6960=
=FtWi
-----END PGP SIGNATURE-----

--tKW2IUtsqtDRztdT--