0

So, when we login to the Red Hat machine we normally develop on, we have to go via another machine due to security reasons. The idea I had was to create an rsa key and connect to the next machine using ssh. I did this in the .cshrc.user file. However, what I did not think of was that the machines share my home drive. This causes the current procedure would create a loop which is not what I want. Do anyone have any ideas how to proceed?

  • Pretty easy: just check the value of the output of hostname (or the variable HOSTNAME if it exists in your default shell) and start ssh only if it contains the nam of your intermediate machine. – Gombai Sándor May 24 '16 at 9:26
  • @GombaiSándor that is how I have solved it now. However, in some environments we have clustered machines, where I get routed to the "best" host. That would make it a bit annoying to solve it like this. – patrik May 24 '16 at 9:50
0

If I understand right, you to go from A (your machine) to C throught B.

So you can try run this command from A.

ssh -A -t ServerB ssh -A -t serverC

If like the thinks more easy and transparent, you can configure ssh ProxyCommand.

  • The problem is that my own machine is a laptop and runs windows 7. I connect to the remote servers using NoMachine (mandatory). The problem is that when I add the ssh to the .cshrc.user file it will start looping. All machines is connected to the same home drive and this means that every time I open a new terminal I do ssh, but when ssh connect to the next server it will run .cshrc.user as well. The server I normally use is not a cluster (which means I do not get routed to another server in the cluser), but a single server. So a condition in the .cshrc.user file will work in most cases. – patrik May 26 '16 at 6:47

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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