Important: For all of the below examples, you must change the following keywords from the example:
argonneusername becomes your actual Argonne username.
targetusername becomes your username on the specific system in question (may not be your Argonne username)
ssh_key_location becomes the path to the SSH key you wish to use (eg. ~/.ssh/id_rsa or ~/.ssh/id_ed25519)
If you named your SSH key anything other than the default, you’ll need to specify that in the configuration.
For the examples in the below table, please make sure your .ssh/config file has the following defined already:
Host login-gce Hostname logins.cels.anl.gov user argonneusername IdentityFile ssh_key_location
If you don’t have this defined, the examples below may not work. The above section is mandatory.
The next section is optional but recommended to be at the top of the file:
ForwardAgent yes ServerAliveInterval 60
Putting that section in will reduce the number of dropped connection you may experience, as well as reduce the number of times you’ll need to type your passphrase or a password. If you’re using an ssh agent, you’ll want your keys added to that agent. Each OS has its own way of doing this, however “ssh-add /path/to/private_key” should work. You can see what keys are in your agent with ssh-add -l.
In the examples below, the optional ForwardX11Trusted is used. You can omit that if you do not want to forward X11 connections. Note if you do, only “ForwardX11Trusted” will work, and not “ForwardX11”.
Situation: I want to... | Use this command to connect | Notes |
---|---|---|
Connect to homes.cels.anl.gov | ssh homes-gce | This is the GCE equivalent of "ssh login.mcs.anl.gov" and will land you on the general use interactive nodes. |
Insert this into .ssh/config | Host homes-gce |
|
Connect to GCE compute nodes | ssh compute-01.cels.anl.gov ssh compute-02.cels.anl.gov ssh compute-03.cels.anl.gov ssh compute-foo.cels.anl.gov | Any hostname matching "compute-*.cels.anl.gov" will get this config. You must use the fully qualified hostname for this to work. |
Insert this into .ssh/config | Host compute-*.cels.anl.gov |
|
Connect to any legacy computer | ssh login.mcs.anl.gov ssh compute001.mcs.anl.gov ssh mydesktop.mcs.anl.gov | Note the targetusername may not be the same as your Argonne username. Any hostname ending in .mcs.anl.gov will get this config. If your legacy account is using a different key than your GCE account, you'll need to specify that in this section with the IdentityFile option. |
Insert this into .ssh/config | Host *.mcs.anl.gov |
|
Connect to any MCS or CELS computer | ssh login.mcs.anl.gov ssh compute-01.cels.anl.gov ssh mydesktop.cels.anl.gov | Note the targetusername may not be the same as your Argonne username. Any hostname ending in .mcs.anl.gov or .cels.anl.gov will get this config. Only use this configuration if your Legacy/MCS and Argonne usernames are the same, and if you use the same SSH key for all the hosts. |
Insert this into .ssh/config | Host *.mcs.anl.gov *.cels.anl.gov !logins.cels.anl.gov |
|
Connect to a specific host without having to type the full domain name. | ssh shortname | You can repeat this for as many host-specific entries as you want. If the hosts at "logins.cels.anl.gov" are able to connect with them, you will be able to use this to proxy through. |
Insert this into .ssh/config | Host shortname |