This is an old revision of the document!
Table of Contents
SoCS SSH Access
The Basics
SSH is a program that allows you to log in to and run programs on a remote server. It is used in the School of Computer Science to allow access to our Linux Servers where you can edit, compile, and run code for your labs and assignments.
Accessing your SSH Client
To use SSH to connect to SoCS Servers, you will first need an SSH client. SSH is available on all three main operating systems.
Windows
A built in client is now available on Windows. You can access it by opening Windows Powershell.
To check if ssh is installed, Open Windows Powershell, and type “ssh” followed by enter. You should see the following:
This client should be available by default, but if it is missing, follow the instructions in the Install SSH on Windows section below.
Mac OS
The SSH client comes automatically installed as part of Mac OS. To access the ssh client, open the Terminal application.
Linux
The OpenSSH Client is available through your Package Manager on all major Linux Distributions. To install the client on a Debian/Ubuntu based distribution using Apt, install the openssh-client package. To install on a RedHat based distribution using Yum, install the openssh-clients package. Once installed you can access ssh through your distribution's terminal application.
SSH from Off-Campus
All Platforms
- Type “cd ~/.ssh” at the command prompt (without the quotes).
- If you get an error “.ssh No such file or directory”, type “cd ~”, then “mkdir .ssh”, then type “cd .ssh”, otherwise ignore this step.
- Use your favourite command line editor (vim, nano, emacs, etc.) to edit the authorized_keys file
- i.e. type 'nano authorized_keys' at the command line
- Unless you've done this step once already, you will be creating this file. it MUST be called authorized_keys
- Paste in the long string of text that you copied to your clipboard in step A
- Save the file.
- Log out of the server.
Part C For all platforms
- Open terminal window, or Powershell (Windows only)
- ssh to portkey.socs.uoguelph.ca
- You SHOULD be prompted for the passphrase you used in Part A, and then you should connect to our linux servers (ssh central-ID@linux.socs.uoguelph.ca).
- This login method works for secure FTP programs too, such as filezilla, which will allow you to ftp files directly to your linux account.
Notes and Info
- If you are unable to bring your private key to campus (via a laptop, removable storage device, etc.) and cannot transfer files via NoMachine, you must send your public key to help@socs.uoguelph.ca. Your public key will then be put into your home folder. This process may take up to a day to complete, so it is recommended to only use this option as a last resort.
- Once the key has been added to the server, attempt to ssh from off campus using ssh central-ID@portkey.socs.uoguelph.ca, agreeing to any prompts that you receive while connecting. You will be prompted to input the password you saved during the keygen creation here.
- If ssh is not able to find your private keys file, you can include the -i flag to specify the location of your keys (ex. ssh jdoe@uoguelph.ca -i ~/.ssh/id_ed25519)
- NOTE: The portkey server is a jump server and has nothing installed. You will not be able to run/compile code on this server - its sole purpose is to connect you to the main server cluster (linux.socs.uoguelph.ca).
- After connecting to portkey, ssh again into central-ID@linux.socs.uoguelph.ca to ensure that your connection is successful.
Advanced User SSH Key Setup Guide
If you feel confident in your ability, below are the list of commands that you can execute to get your key onto the server while on campus. This guide is suited for students that can troubleshoot common Linux issues related to ssh and file movement. If you are not confident, follow Part A For all platforms above for a more in-depth guide.
Server-Side Setup
ssh central-ID@linux.socs.uoguelph.ca cd ~ mkdir .ssh cd .ssh ls touch authorized_keys (if the file already exists, skip this step)
Local Machine
ssh-keygen -t ed25519 -C central-ID@linux.socs.uoguelph.ca scp ~/.ssh/id_ed25519.pub central-ID@linux.socs.uoguelph.ca:~/.ssh/ed25519.pub
On linux.socs.uoguelph.ca
cd ~/.ssh cat ed25519.pub >> authorized_keys exit
Using VSCode with Portkey
- Open up VSCode and click on the “Extensions” icon in the left sidebar. Search for “Remote - SSH” and install the extension.
- Once the extension is installed, click on the “Remote Explorer” icon in the left sidebar. Then, click on the “SSH Targets” dropdown and select “Add SSH Host”.
- In the “SSH Targets” dropdown, select “Configure SSH Hosts”. This will open up your SSH config file in VSCode
- In the SSH config file, add the following code
Host portkey Hostname portkey.socs.uoguelph.ca User your_username Host linux Hostname linux.socs.uoguelph.ca User your_username ProxyCommand ssh -q -W %h:%p portkey
- Replace your_username with your actual username for both the jump host and target box.
- Save the SSH config file and close it.
- In the “SSH Targets” dropdown, you should now see two new entries: “portkey” and “linux”. Click on “linux”.
- You'll be prompted to enter your password for the target box. Enter it and click “OK”.
VSCode will now open a new window with a terminal connected to the target box through the jump host. You can now work on files and run commands on the target box as if you were working on it directly.
This section was generated by ChatGPT