Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
808 views
in Technique[技术] by (71.8m points)

ssh - Setup ssh_config with proxies when AllowTCPForwarding is not allowed

How can you write the following setup in an ssh config.

### The Bastion Host
Host bastion-host-nickname
  HostName bastion-hostname

### The Remote Host
Host remote-host-nickname
  HostName remote-hostname
  ProxyJump bastion-host-nickname

### The Remote Host VM
Host remote-host-vm-nickname 
  Hostname remote-vm-hostname 
  ????

I have a bastian sever through which my remote-host can be reached via ssh. This connection is working as expected. On my remote-host there are a few virtual machines (the remote host vm) that can also be reached via ssh.

AllowTCPForwarding is disabled in the sshd_config of the remote-host. Therefore neither an SSH tunnel nor a ProxyCommand can be used. With both you get the error message "... administratively prohibited". The sshd_config should stay that way.

My preferred approach is that I connect to the remote-host and execute the following command:

[@remote-host]
"ssh -t -i keyfile user@remote-vm-hostname " whoami  ""

How can I describe this ssh command in my ssh_config? Especially so that this ssh command can only be executed on my remote host.

question from:https://stackoverflow.com/questions/65933293/setup-ssh-config-with-proxies-when-allowtcpforwarding-is-not-allowed

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...