Forum: Ruby file attributes

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C9030f7616a7da0dd3e7bf4987f46f07?d=identicon&s=25 Krekna Mektek (Guest)
on 2007-01-06 19:30
(Received via mailing list)
Lo!

Busy with my program, I run in to 2 questions.

In a certain method I want to open a ssh connection by a certain user.
I need to sudo to an ssh user to make the passwordless connection via
public-private key authorization. How can I do this in Ruby?
FYI: I am not allowed to use sudo su - ssh -c [ssh command].

Thanks,
Krekna
97550977337c9f0a0e1a9553e55bfaa0?d=identicon&s=25 Jan Svitok (Guest)
on 2007-01-19 16:29
(Received via mailing list)
On 1/5/07, Krekna Mektek <krekna@gmail.com> wrote:
> Lo!
>
> Busy with my program, I run in to 2 questions.
>
> In a certain method I want to open a ssh connection by a certain user.
> I need to sudo to an ssh user to make the passwordless connection via
> public-private key authorization. How can I do this in Ruby?
> FYI: I am not allowed to use sudo su - ssh -c [ssh command].

1. you can start programs by `command` or Kernel#system, or IO#popen
2. you probably want to call `sudo -u <username> ssh -c <command>`
   or even
  user = 'joe'
  cmd = 'ls'
  `sudo -u #{user} ssh -c #{cmd}`
  but then be careful what you are passing there.
This topic is locked and can not be replied to.