[paramiko] Handling sudo
Stan
k12umm at gmail.com
Tue Mar 4 16:33:32 PST 2008
Cant you just pipe the password and grab the outputs/readlines? For example
the command i have to run as sudo = rsh dunebot cifs top
so I just send the command = echo mysuperhardpassword | sudo -S rsh dunebot
cifs top
and that seems to work in normal ssh.
>>> Justin Cook wrote:
>>>> 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!
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>> "Formulations of number theory: Complete, Consistent, Non-trivial.
>>> Choose two."
>>
>> --
>> "Formulations of number theory: Complete, Consistent, Non-trivial.
>> Choose two."
>
--
"Formulations of number theory: Complete, Consistent, Non-trivial. Choose
two."
Animal Logic
http://www.animallogic.com
Please think of the environment before printing this email.
This email and any attachments may be confidential and/or privileged. If you
are not the intended recipient of this email, you must not disclose or use
the information contained in it. Please notify the sender immediately and
delete this document if you have received it in error. We do not guarantee
this email is error or virus free.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.lag.net/pipermail/paramiko/attachments/20080305/6145dcde/attachment.htm
More information about the paramiko
mailing list