SSH keys and logging in

Adding an SSH key

Access to the Grid itself is done using SSH keys—you will only use a password to log in to the web interface. You may add and remove SSH keys in the SSH key profile pane. The steps below walk through creating a new SSH key and uploading it to the Grid. For more details on using SSH keys, see GitHub’s documentation.

  1. Open a terminal on your personal computer (either the built-in terminal in Linux/MacOS or through MobaXterm for Windows).
  2. Execute the following command: ssh-keygen -t ed25519 -C “USERNAME@drexel.edu”, replacing USERNAME with your Drexel username. This creates a new ssh key with an associated comment (via -C) consisting of your Drexel email.
  3. When you are prompted to Enter a file in which to save the key, press Enter to accept the default file location in the ~/.ssh directory. Recall that ~ is shorthand for your home directory, so ~/.ssh is the directory named .ssh that is in your home directory.
  4. When asked, specify a password for your key at the prompt. Remember this password. You may also leave the password blank. If you specify a password, you will need to enter it every time you use the key unless you use ssh-agent.
  5. After your key pair is generated, navigate to ~/.ssh (use cd) and execute the command cat id_ed25519.pub to output the contents of the file id_ed25519.pub to the terminal. This is your public key.
  6. Go to the SSH key profile pane on the Grid web interface, copy your public key from the terminal, and paste it into the “Key” field. After you paste the public key and give it an optional title in the “Title” field, press “Add key” to upload your key. Be sure to add your public key to your account—if you try to add your private key, you will receive an error.

Logging in with SSH on Linux/macOS

On a UNIX-based machine, connect to the grid at the terminal by executing the following command. Be sure to replace USERNAME with your Grid username. If you are a Drexel student, your Grid username is the same as your Drexel username.

  1. Run ssh -i ~/.ssh/id_ed25519 USERNAME@dwslgrid.net in your terminal.

If you need X11 forwarding, add the -X option to the command line above (the X is capitalized).

Logging in with SSH on Windows (MobaXterm)

  1. Install MobaXterm.
  2. Open MobaXterm and click “Start Local Terminal.”
  3. Follow step 1 in the Linux/Mac OS section above.

Logging in to a Grid node

Once you have launched a reservation and its status is “Running,” you may connect to any of the nodes that are part of the reservation using SSH. You must connect using your Grid username and one of the SSH keys that you previously uploaded to the Grid. All nodes are on a private network that is only accessible via dwslgrid.net, so to connect to a node, you must go through dwslgrid.net. The most straightforward way to accomplish this is to have SSH proxy the connection through dwslgrid.net, for example with ssh -J USERNAME@dwslgrid.net USERNAME@grid01. Your private key stays on your own computer, and the configuration below makes this automatic. You could instead copy your private key to dwslgrid.net and SSH to the node from there, but then your private key is stored on a shared machine.

Proxying SSH connections through dwslgrid

See the OpenSSH Cookbook entry on proxies and jump hosts for details on how to automatically proxy SSH connections to instances through dwslgrid.net. If you are connecting to the Grid from a Linux or Mac, adding a section to your ~/.ssh/config along the lines given below on your personal machine will allow you to connect easily to both dwslgrid and individual grid nodes. Be sure to replace USERNAME with your username and PRIVKEYFILE with the name of your private key. If you generated a key pair using the instructions above, PRIVKEYFILE should be id_ed25519.

Host dwslgrid dwslgrid.net
  HostName dwslgrid.net
  User USERNAME
  IdentityFile ~/.ssh/PRIVKEYFILE
  ForwardX11 yes
  ServerAliveInterval 60
  ServerAliveCountMax 2

Host grid??
  HostName %h
  StrictHostKeyChecking no
  UserKnownHostsFile /dev/null
  User USERNAME
  IdentityFile ~/.ssh/PRIVKEYFILE
  ForwardX11 yes
  ProxyJump dwslgrid