The simple answer is
ssh username@hostname
Enter your password and you are set. My problem is that I wish to connect to a computer in my university. There are several machines which everyone can access but before doing so we have to go through the login machine. So say the name of the login machine is login.school.edu
Then I would do
ssh login.school.edu
From there then I would ssh to one of the several machine names
ssh ld00
They have 112 machines, so I can do ld00 through ld112. The reason I'm asking this is because I want to run the Mathematica Kernel in one of these machines but in the Kernel configuration it asks for the hostname. The hostname cannot be the login machine because this machine does not have Mathematica installed and this machine wasn't meant for computations. Any way I can bypass this?
So it seems that those machines are not public in the internet. Now that I'm in the deparment I connected to the network and now I can do a simple
ssh username@hostname
The administrator of the machines did say something interesting:
I do not know what SSH implementation is currently part of MacOS. Under OpenSSH (used on Linux machines) it is theoretically possible to make creative use of the ProxyCommand directive to make it appear as if those hosts are directly available to SSH. I cannot tell you how to do this, however; I've only seen mention of it.
So, does anyone know how to do this so that I can connect to the kernel from outside the school?
Answer
From your update, your situation is very similar to mine, where I can connect to hostA through the internet, but to hostB only via hostA. Here is the pared down settings from my ~/.ssh/config that you can adapt to your machines:
Host hostA
HostName hostA.school.edu
User rm
ForwardX11 yes
ForwardX11Trusted yes
ControlMaster auto
ControlPath ~/.ssh/control:%h:%p:%r
Host hostB
Hostname hostB.school.edu
User rm
ProxyCommand ssh -T -a hostA nc %h %p
Here, using ControlMaster and ControlPath lets you tunnel all subsequent connections to hostA via an existing connection. So this means that you need to have only 1 open connection (need password, if not using keys) and you needn't enter your password again as long as that session is alive (extremely convenient and useful in general!).
The second, using ProxyCommand allows you to login to the second through the first. So if you have one open connection to hostA, you can then simply ssh hostB on your local machine and the connection will automatically be routed through hostA. Now if you didn't set up ControlMaster and ControlPath, you'll have to enter 2 passwords — one for hostA and another for hostB.
Comments
Post a Comment