[paramiko] Handling sudo

Justin Cook jhcook at gmail.com
Tue Feb 26 06:25:16 PST 2008


Ok, I'm an idiot. Password prompt goes to stderr...

On Tue, Feb 26, 2008 at 1:55 PM, Justin Cook <jhcook at gmail.com> wrote:
> There are a couple ways I can see to do it readily offhand. One, I
>  haven't figured out how to receive the sudo password prompt yet.
>  Apparently, it writes the password prompt to a terminal device. So,
>  you should be able to set an alarm and send the password down the
>  channel in event there is no response from the command. This is dirty
>  IMO.
>
>  Secondly, and perhaps more clean to use in conjunction with the first
>  option, is to use the -k or -K option to invalidate the sudo timestamp
>  and thus requiring to send the password on every invocation and not
>  worry about whether or not you've been prompted. However, this isn't
>  very clean either in case no password is required.
>
>  Not a good solution in either respect in my opinion. If this can be
>  done easily with SSHClient someone shoot me in the foot!



-- 
Justin Cook



More information about the paramiko mailing list