0

This is my connection graph: user --> example.server on port 22 with username1/password1 --> example.server with username2/password2 on different port (some ssh subsystem port, e.g. 1000). I cannot connect any other way.

What would I need to do so I can write this and connect automatically to port 1000:

shh username1@example.server -s subsystem

password1:

0

The configuration option you are looking for is ProxyCommand. It was solved many times here or on ServerFault [1], so once more:

Set up your workstation with this ssh_config:

Host server2
  HostName ruapehu.example.com
  Port {server2 port}
  User {server2 user}
Host server1
  ProxyCommand ssh server2 -W %h:%p
  Port {server1 port}
  User {server1 user}

and whenever you will want to connect to server2, just do

$ ssh server2

You will need to set up passwordless authentication or enter both your passwords. Passwordless authentication is most secure when you will use ssh-agent and AgentForwarding option.

[1] Forward SSH traffic through a middle machine

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.