[paramiko] Handling sudo

Christian Vest Hansen karmazilla at gmail.com
Wed Mar 5 02:38:17 PST 2008


On 3/5/08, Jon Sabo <jonathan.sabo at gmail.com> wrote:
> You could put it in a file and then cat the file so every other user
>  on the box can't see your password with ps -ef.

But then they could read the file, no? How would guarentee -rw-------
permisions?

>
>  2008/3/4 Stan <k12umm at gmail.com>:
>
> > 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.
>  >
>  >
>  >
>  >
>  >
>
> > _______________________________________________
>  >  paramiko mailing list
>  >  paramiko at lag.net
>  >  http://www.lag.net/cgi-bin/mailman/listinfo/paramiko
>  >
>
>  _______________________________________________
>  paramiko mailing list
>  paramiko at lag.net
>  http://www.lag.net/cgi-bin/mailman/listinfo/paramiko
>


-- 
Venlig hilsen / Kind regards,
Christian Vest Hansen.



More information about the paramiko mailing list