Python & Linux, some questions (2)

Hamilcar Barca hamilcar at never.mind
Tue Mar 16 04:45:53 CET 2004


In article <c353om$23bqmc$1 at ID-99001.news.uni-berlin.de> (Mon, 15 Mar 2004
21:28:47 +0100), Luca T. wrote:

> r,w,e = popen2.popen3('su -c ls')
> 
> So it seems that "su" refuses to work if it is run like this.

su needs the user's password and it insists on reading it from a tty
because it can control echoing.

> any idea about how i could run a 
> program as root from inside my python program?

1) Can you run your program in a shell?  The user will still need
   root's password.

2) Create a copy of ls and make it suid root.  The user will be able
   to list the files in any directory -- will this compromise security?



More information about the Python-list mailing list