Generating an SSH key automatically

Modified: 22 May 2023 20:10 UTC

In macOS and Linux environments, the Triton Service portal can quickly generate SSH key pairs. If you are working in a Windows environment, visit Manually generating an SSH key in Windows.

We recommend ECDSA or RSA keys. DSA keys are supported, but not recomended.

Generating a SSH key

  1. Navigate to the Triton Portal and open the Account Summary.
  2. From the SSH section, select Create SSH Key.
  3. In the Create SSH Key dialog, enter a Key Name and then select Create Key. The private and public SSH key pairs generate. When complete, Triton confirms that SSH keys have been successfully added to your account.
  4. In response to the confirmation message, click Ok. Triton generates a public and private key pair and downloads them to your local computer.
  5. Move the keys into the appropriate directory for your operating system. To move the keys in a macOS, run the following commands in a terminal:
$ mkdir ~/.ssh
$ mv ~/Downloads/<ssh key name>_id_rsa ~/.ssh/.
$ chmod 400 ~/.ssh/<ssh key name>_id_rsa
$ mv ~/Downloads/<ssh key name>_id_rsa.pub ~/.ssh/.

Uploading an SSH key

If you have an existing SSH key pair, you can upload the public SSH key to your Triton account.

  1. From the Triton Service portal, select Account to open the Account Summary page.
How to access the Account Summary page.
  1. From the SSH section, select Import Public Key.
  2. Enter a Key Name. Although naming a key is optional, labels are a best practice for managing multiple SSH keys.
  3. Copy and paste the public SSH key and upload the file.

When Triton finishes the adding or uploading process, the public SSH key appears in the list of SSH keys.

SSH agent

ssh-agent is a program that stores encrypted SSH key passwords. Adding SSH keys to an agent is optional. Triton authenticates using the key fingerprint so you don't need to add SSH keys to the agent if you did not assign passwords to your keys.

If your keys are passphrase-protected, Triton requires that you add them to ssh=agent.

Adding SSH Keys to agent

If you decide to add your SSH keys to the ssh agent, use the default ssh-add command. Don’t use an external application installed by macports, homebrew, or another external source.

  1. In a terminal, start the ssh-agent:
$ eval "$(ssh-agent -s)"
Agent pid 49186

If you are running a macOS Sierra 10.12.2 or later, you must modify the ~/.ssh/config file to automatically load keys into the ssh-agent and store passphrases in your keychain. Read Apple's technotes for more information.

If you are running Windows or an earlier version of macOS, skip this step.

  1. To modify the ~/.ssh/config file:
Host *
 AddKeysToAgent yes
 UseKeychain yes
 IdentityFile ~ /.ssh/id_rsa
  1. Add the SSH private key to the ssh-agent and store your passphrase in the keychain.
$ ssh-add -K ~/.ssh/<key-name>
  1. To automatically log out at the end of your session, add the following command in the .logout file or your .bash_logout file, whichever is appropiate for your operating system.
$ kill $SSH_AGENT_PID

Generating SSH keys manually

For Windows environments and developers who take a hands-on approach, learn more about generating an SSH key pair from the command line:

What are my next steps?