file attributes

K

Krekna Mektek

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
 
J

Jan Svitok

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top