SSH Keys
SSH (Secure Shell) keys are an access credential that is used in the SSH protocol used to login remotely from one system into another. Essentially, SSH keys are an authentication method used to gain access to an encrypted connection between your computer and our remote instances.
Generating a new SSH Key.
There are serveral public key algorithms for authentication keys. You can research which is best for you but we would recommend using either rsa or ed25519. Comparing SSH algorithms
- Windows
- macOS
Generating a new SSH Key
- Open your terminal on your computer
ssh-keygen -t ALGORITHM -C "your_email@example.com"
This creates a new SSH key, using the provided email as a label.
> Generating public/private ALGORITHM key pair.
When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.
> Enter file in which to save the key (/c/Users/you/.ssh/ALGORITHM):
- You will then be prompted to enter a passphrase. This is optional but recommended.
> Enter passphrase (empty for no passphrase): [Type a passphrase]
> Enter same passphrase again: [Type passphrase again]
Adding your SSH key to the ssh-agent
- In a new admin PowerShell window, make sure the ssh-agent is running.
> Get-Service -Name ssh-agent | Set-Service -StartupType 'Manual'
> Start-Service ssh-agent
- Add your SSH private key to the ssh-agent.
> ssh-add c:/Users/YOU.ssh/ALGORITHM
Adding your SSH key to Massed Compute Account
- Open your terminal on your computer
clip < ~/.ssh/ALGORITHM.pub
This copies the contents of the id_ed25519.pub file to your clipboard.
If you chose a different algorithm or file name, replace id_ed25519 in the command with the name of your private key file.- Log in to your Massed Compute Account
- On the left menu click on
Settings
then selectSSH Keys
from the secondary navigation. - Click on
Add Key
in the SSH Keys section. - Provide a common name and paste the contents of the clipboard into the
SSH Key
field.
Adding your SSH Key to the instance on deployment
- When you deploy an instance you can select one or multiple SSH keys you want to associate with the instance.
- Once the Instance is Running you can then SSH into the instance using the SSH key you provided.
ssh -i ~/.ssh/ALGORITHM Ubuntu@VM_IP
Again, if you used a different algorithm or file name, replace id_ed25519 in the command with the name of your private key file.
Generating a new SSH Key
- Open your terminal on your computer
ssh-keygen -t ALGORITHM -C "your_email@example.com"
(We recommend ed25519 as your algorithm)
This creates a new SSH key, using the provided email as a label.
> Generating public/private ALGORITHM key pair.
When you're prompted to "Enter a file in which to save the key," press Enter. This accepts the default file location.
> Enter file in which to save the key (/Users/YOU/.ssh/id_ALGORITHM):
- You will then be prompted to enter a passphrase. This is optional but recommended.
> Enter passphrase (empty for no passphrase): [Type a passphrase]
> Enter same passphrase again: [Type passphrase again]
Adding your SSH key to the ssh-agent
- Start the ssh-agent in the background
> eval "$(ssh-agent -s)"
> Agent pid 59566
- Modify your
~/.ssh/config
file to automatically load keys in your keychain.
- Open or create the
~/.ssh/config
file in your favorite editor. - Add the following lines to the file:
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_ALGORITHM
- Add your SSH private key to the ssh-agent. and store your passphrase in the keychain.
ssh-add --apple-use-keychains ~/.ssh/id_ALGORITHM
Adding your SSH key to Massed Compute Account
- Open your terminal on your computer
clip < ~/.ssh/ALGORITHM.pub
This copies the contents of the id_ed25519.pub file to your clipboard.
If you chose a different algorithm or file name, replace id_ed25519 in the command with the name of your private key file.- Log in to your Massed Compute Account
- On the left menu click on
Settings
then selectSSH Keys
from the secondary navigation. - Click on
Add Key
in the SSH Keys section. - Provide a common name and paste the contents of the clipboard into the
SSH Key
field.
Adding your SSH Key to the instance on deployment
- When you deploy an instance you can select one or multiple SSH keys you want to associate with the instance.
- Once the Instance is Running you can then SSH into the instance using the SSH key you provided.
ssh -i ~/.ssh/ALGORITHM Ubuntu@VM_IP
Again, if you used a different algorithm or file name, replace id_ed25519 in the command with the name of your private key file.
To terminate your session you can type exit
and hit enter in the terminal or Ctrl + D on your keyboard.