setuid root

  • Thread starter Tiago =?iso-8859-1?Q?Sim=F5es?= Batista
  • Start date
T

Tiago =?iso-8859-1?Q?Sim=F5es?= Batista

Hello all

I have a situation that requires that a python script, that is
run from a webpage (via php exec()) must be run with root privileges.

The sysadmin already set the setuid bit on the script, but it
still fails when it tries to write to any file that only root has
write access to.

I read somewhere that any scripts that start with "#!" will no
honour the setuid bit...

I also tried os.setuid(0), with the setuid bit on, but this call
failed.

I am now out of ideas :(

Any sugestions?

Tiago
 
P

Patrick Useldinger

Tiago said:
The sysadmin already set the setuid bit on the script, but it
still fails when it tries to write to any file that only root has
write access to.

use sudo.
 
T

Tiago Batista

use sudo.

Thank you, both fot you and for Ove Svensson.

I was looking for a simpler way, that required as little intervention as possible from the main sysadmin. Given the situation I am facing, I will probably use sudo, it keeps things cleaner...

Again, thank you

Tiago

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (GNU/Linux)

iD8DBQFE7fRlcERmrF/iXCsRAoSGAKCXM2X6TaEXSE/IA4nS5SAUztc/ZgCghOKp
K02Z57Xa+l9RDU1hhnPjy8w=
=4BUk
-----END PGP SIGNATURE-----
 
Joined
Jan 30, 2011
Messages
1
Reaction score
0
Write it in C

Not exactly a python solution, but you could certainly call a c program with the SUID bit set from the python script to circumvent this. Just be careful that you limit the functionality of the c program to a specific task as it will have to be executable from the web account.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top