Installing your Public Key

In some cases, you may be expected to take a key you just generated and "install" it on a remote server that you have password access to. The instructions below can be used to install your public key on a target host.

If you haven't generated your SSH keypair yet, you can look at our keypair generation documentation before following these steps.

Installation Steps

  1. Identify your public key file. On Linux and MacOS, you can find it in a terminal under ~/.ssh. The exact filename for your public key file will vary depending on what type of key you generated (with the -t flag). We recommend using ED25519 for your SSH key, so for the sake of these instructions, we'll assume the key is located at ~/.ssh/id_ed25519.pub. If you generated a different type, the type of key will be reflected in the filename. Eg ~/.ssh/id_rsa.pub if you generated an RSA key instead.

    On Windows, your key will probably be found under C:\Users\username\.ssh with the same file naming rules as described above.

  2. On the target host (the one that needs to have your public key installed), look for a file called ~/.ssh/authorized_keys (eg. ls ~/.ssh/authorized_keys). If a file is present, you'll want to add your new key to the end of that file. This should be as simple as copying and pasting the contents of you generated public key file and adding it to the end of the ~/.ssh/authorized_keys file by using your favourite text editor on the target host.

    If there is no authorized_keys file, you will need to prepare your .ssh path with appropriate permissions in order to successfully install your public key:

    1. First, create the .ssh path with mkdir ~/.ssh in a shell on the target host.
    2. Second, limit the permissions so that only you have access to that directory by typing chmod 700 ~/.ssh on the target host.
    3. Finally, create the ~/.ssh/authorized_keys file either with your favourite editor or through any other method that suits you better (eg. echo "ssh-ed25519 AAA..." > ~/.ssh/authorized_keys). Once the file has been created, you'll need to fix permissions for it as well by typing: chmod 600 ~/.ssh/authorized_keys.
  3. Test your login with your private key.

If you have problems logging in after following these steps, you can contact helpdesk for additional support.

results matching ""

    No results matching ""