3

For some actions, I need to ssh with ssh -X user@host. Is it possible for Ruby's Net::SSH to use this (with emphasis on the -X)?

Net::SSH.start('host', 'user', password: 'password') do |ssh|
  # Do work
end

I'm not currently seeing any options to enable X11 Forwarding. Are there any options for this?

Update

More information found in the SSH Manual

-X Enables X11 forwarding. This can also be specified on a per-host basis in a configuration file.

X11 forwarding should be enabled with caution. Users with the ability to bypass file permissions on the remote host (for the user's X authorization database) can access the local X11 display through the forwarded connection. An attacker may then be able to perform activities such as keystroke monitoring.

For this reason, X11 forwarding is subjected to X11 SECURITY extension restrictions by default. Please refer to the ssh -Y option and the ForwardX11Trusted directive in ssh_config(5) for more information.

Background

Essentially I am automating a process. Users right now ssh into a server and run some commands with the -X option. I'm told that the -X option is a requirement. I've successfully used Net::SSH to do the commands, but I'm still told they need the -X option to present.

ardavis
  • 9,842
  • 12
  • 58
  • 112
  • What do you mean by *to enable X11 Forwardin* ? – Arup Rakshit Sep 26 '13 at 15:37
  • Just updated my question :) Thanks for asking! I'm hoping for a way to mimic `ssh -X` with `Net::SSH`. – ardavis Sep 26 '13 at 15:42
  • just got hit by this problem too. Did you figure out a solution? – Rick Deckard Jan 23 '15 at 00:04
  • Unfortunately I did not. I ended up talking with the people who required me to do it, and had them change their end so it was no longer required. But this would still be a great question to be answered for those who need it. – ardavis Jan 23 '15 at 13:23

0 Answers0