SSH

From SciNet Users Documentation
Revision as of 17:32, 31 July 2018 by Ejspence (talk | contribs)
Jump to navigation Jump to search

SSH (secure shell) is the only way to log into the systems at SciNet. It opens a secure, encrypted connection between your computer and those at SciNet, protecting not only your password, but all other data going between the machines. If you have a Linux or Mac OSX machine, you already have SSH installed; if you have a Windows machine, you will have to install additional software before logging into SciNet.

SSH For Linux or Mac OS X Users

Simple Login

To login to the systems at SciNet, you will have to open a terminal in Linux, or Mac OS X, and type

slogin USERNAME@niagara.scinet.utoronto.ca

where you will replace USERNAME with your username; you will then be prompted to type your password. Once done, you will be logged into the login nodes at the SciNet data centre, as if you have a terminal from those machines on your destop.

Note that if your username is the same on both the machine you're logging in from and the scinet machines, you can drop the USERNAME@, as SSH by default will try to use the username on the machine you are logging in from.

X11 Forwarding

If during this login session you will only need to be typing and reading text, the above will suffice. If in a session, however, you will need to be displaying graphics — such as plotting data on the scinet machines or using our performance profiling tools — you can use SSH's very powerful ability to forward several different types of data over one connection. To enable "X11 forwarding" over this SSH connection, add the option -Y to your command,

slogin -Y USERNAME@niagara.scinet.utoronto.ca

Note that within the SciNet systems, you don't need to supply your username, as it is the same across all systems. Note too that you won't need to supply a password, as SSH has other ways to authenticate logins, as well.

Copying Files

The SSH protocol can be used for more than logging in remotely; it can also be used to copy files between machines. The advantages are the same; both your password and the data you are sending or receiving are secure.

To copy small files from your home computer to a subdirectory of your /scratch directory at SciNet, you would type from a terminal on your computer

scp filetocopy.txt USERNAME@niagara.scinet.utoronto.ca:/scratch/USERNAME/some_subdirectory/

Note that soon the location of your scratch directory will change, and you will have to type:

scp filetocopy.txt USERNAME@niagara.scinet.utoronto.ca:/scratch/G/GROUPNAME/USERNAME/some_subdirectory/

Similarly, to copy files back into your current directory, you would type

scp USERNAME@niagara.scinet.utoronto.ca:/scratch/G/GROUPNAME/USERNAME/my_dirs/myfile.txt . 

The Data Management wiki page has much more information on doing large transfers efficiently.

SSH for Windows Users

To use SSH on Windows, you will have to install SSH software. SciNet recommends, roughly in order of preference:

  • Cygwin is an entire linux-like environment for Windows. Using something like Cygwin is highly recommended if you are going to be interacting a lot with linux systems, as it will give you a development environment very similar to that on the systems you'll be using. Download and run setup.exe, and install any packages you think you'll need. Once this is done, you will have icons for terminals, including one saying something like "X11". From either of these, you'll be able to type slogin user@login.scinet.utoronto.ca as above; if you think you will need to pop up windows from SciNet machines (e.g., for displaying data or using Profiling Tools), you'll need to use the X11 terminal and type slogin -Y user@login.scinet.utoronto.ca. Other ssh tools such as scp will work as above.
  • MobaXterm is a tabbed ssh client with some Cygwin tools all wrapped up into one executable.
  • OpenSSH For Windows installs only those parts of Cygwin necessary to run SSH. Again, once installed, opening up one of the new terminals allows you to use SSH as in the Linux/Mac OSX section above, but X11 forwarding for displaying windows may not work.
  • PuTTY is one of the better stand-alone SSH programs for windows. It is a small download, and is enough to get you logged into the SciNet machines. For advanced use like X11 forwarding however, you are better off using Cygwin. A related program, PSCP, can be used to copy files using a graphical user interface.
    WARNING: Make sure you download putty from the official website, because there are "trojanized" versions of putty around that will send your login information to a site in Russia (as reported here).

SSH keys