Discussion:
ssh - sudo with password
Kubes
2013-08-07 20:21:28 UTC
Permalink
What is the best means to handle a server requesting and then passing
passwords for ssh and sudo commands? ex: ssh('sudo pwd')?

I need to run commands on servers that the sudoers config requires
passwords. I see the request in stdout, but how to I "supply" the password?

Thanks
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Kyle Rames
2013-08-08 13:58:35 UTC
Permalink
Hi Kubes,

I looked at the ssh code in fog real briefly this morning and it does not
appear that it was designed with interactive sessions in mind.

I think you are better off trying to use the Net::SSH library directly.
This example should help get you started:

http://net-ssh.rubyforge.org/ssh/v2/api/classes/Net/SSH.html#M000002

To give you an idea of fog's ssh abilities you can refer to this:

https://github.com/fog/fog/blob/master/lib/fog/core/ssh.rb#L63-L107

Hope that helps! If not, let me know and I can try to dig into this further.

Kyle
Post by Kubes
What is the best means to handle a server requesting and then passing
passwords for ssh and sudo commands? ex: ssh('sudo pwd')?
I need to run commands on servers that the sudoers config requires
passwords. I see the request in stdout, but how to I "supply" the password?
Thanks
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Kubes
2013-08-09 15:58:51 UTC
Permalink
Thanks.
Post by Kyle Rames
Hi Kubes,
I looked at the ssh code in fog real briefly this morning and it does not
appear that it was designed with interactive sessions in mind.
I think you are better off trying to use the Net::SSH library directly.
http://net-ssh.rubyforge.org/ssh/v2/api/classes/Net/SSH.html#M000002
https://github.com/fog/fog/blob/master/lib/fog/core/ssh.rb#L63-L107
Hope that helps! If not, let me know and I can try to dig into this further.
Kyle
Post by Kubes
What is the best means to handle a server requesting and then passing
passwords for ssh and sudo commands? ex: ssh('sudo pwd')?
I need to run commands on servers that the sudoers config requires
passwords. I see the request in stdout, but how to I "supply" the password?
Thanks
--
You received this message because you are subscribed to the Google Groups "ruby-fog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-fog+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Loading...