ssh config

From Fluids Wiki
Revision as of 16:51, 2 August 2013 by Fluidslab (talk | contribs)
Jump to navigation Jump to search

You can use the ssh configuration file to save typing the full host name most of the time. For example, "ssh belize" is faster than "ssh belize.math.uwaterloo.ca".

The basics

Create the file ~/.ssh/config, and add the following:

   # MATH hosts
   Host belize thelon winisk kazan zambezi plata fe101 fe105 fe107 cpu105 cpu111 cpu113 cpu119 cpu121 cpu123 cpu125 cpu127
       HostName %h.math.uwaterloo.ca

   # SHARCNET hosts
   Host kraken orca requin saw angel dtn gulf hound lundun mako megamouth monk tope bramble brown goblin gulper guppy iqaluk prism redfin school wobbie
       HostName %h.sharcnet.ca

then change permissions on that config file to be only readable by your user,

   chmod 600 ~/.ssh/config

and you'll be able to ssh directly to all of those hosts by just using the main name.

SciNet

SciNet has a login node that you need to login to first before you can access the transfer/development nodes. You can shortcut this process with a few more lines your ~/.ssh/config file. The following lines make sense for any machine outside of SciNet (your laptop, belize, etc).

  # SciNet
  Host scinet sci
      HostName login.scinet.utoronto.ca

  Host dm1 datamover1
      Hostname datamover1
      ProxyCommand ssh scinet -W %h:%p

  Host dm2 datamover2
      Hostname datamover2
      ProxyCommand ssh scinet -W %h:%p

  Host gpc*
      ProxyCommand ssh scinet -W %h:%p

For the ~/.ssh/config file on your SciNet account, you do not want to include the proxy commands. It only makes sense to include the aliases:

  # SciNet
  Host scinet sci
      HostName login.scinet.utoronto.ca

  Host dm1
      Hostname datamover1

  Host dm2
      Hostname datamover2