Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run another ssh command inside ssh session #869

Open
tannn92 opened this issue Jun 26, 2022 · 0 comments
Open

Cannot run another ssh command inside ssh session #869

tannn92 opened this issue Jun 26, 2022 · 0 comments

Comments

@tannn92
Copy link

tannn92 commented Jun 26, 2022

I have 2 systems I work with that are daisy chained. System A is what I have to connect to initially, then I ssh into system B to run commands to view status of services and other things.

What I want to do is have a ruby script that can get into system B to run some commands and then pass the output from those commands back into my laptop automatically.

I can use ruby gem net/ssh to get into system A and run commands but I cannot figure out how to ssh into system B after I am in system A. This is what I have right now.

Net::SSH.start('123.456.78.9', 'username', password: 'password') do |ssh|
    # some how ssh into system b
end

I tried just ssh.exec! "ssh 123.456.78.30" but that does not work. I tried nesting another Net::SSH.start call but that doesn't work either.

Please help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant