[Tutor] subprocess and su

Eric Brunson brunson at brunson.com
Tue Aug 21 22:57:46 CEST 2007

Tino Dai wrote:
> Hi there,
>      I'm have a tough time figuring out how to get su and subprocess 
> working. I have
> PIPE=subprocess.pipe
> sbp=subprocess.Popen(["su","-",stdin=PIPE,stdout=PIPE,close_fds=True,shell=True) 
> how I thought that it was supposed to work was it would allow me to 
> use sbp.communicate() to
> send stuff to the stdin, and get information out. What do get is a 
> prompt ask for my password. 

I think you have the right understanding of Popen, you seem to be 
missing out on "su".  What happens when you type "su -" on the command line?

> Does
> anybody have an example that I can see (I have already check most of 
> the entries in google( or should
> I just use pexpect instead?
> -Thanks,
> Tino
> ------------------------------------------------------------------------
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

More information about the Tutor mailing list