Manage private SSH keys

SSH key pairs consist of both a public key and a private key file. Learn more about key pairs in xneelo Cloud.

The private key is required when establishing a connection to an instance via SSH. This article provides guidelines around how to store and manage your private keys.


  • Storing private key files

    Private keys are saved in encrypted form (typically protected by a password entered by the user on creation).

    Once you’ve generated a new key pair, you should ensure that the private key file is stored in a secure location. This reduces the risk of threat actors gaining access to your instance.

    You should also ensure that you do not lose the private key file.  If you lose access to your private key you will not be able to connect to your instance via SSH.

    If you haven’t set up any additional users, you will have to create a new instance and assign a new key pair.





  • Create a private key file

    When generating an SSH key pair, both the public and private key will be generated. In some scenarios, you may need to copy the private key text and create a private key file.

    For example, key pairs can be generated during instance creation. The public key will be stored on the instance, but you will need to copy the private key and create a private key pair file in order to connect to the instance later.

    Steps

    1. 1
      Open a text editor on your computer.
    2. 2
      Paste the contents of the private key you just created into the text editor.
    3. 3
      Provide a name for the file with a .pem extension and ensure you select the type as All Files. For example: private-key.pem
    4. 4
      Save the file to a secure location on your computer.
    5. 5
      If you are using macOS or Linux you need to run the following command to use your saved private key:

    Open a terminal window on your computer.

    Type in the following command:

    chmod 600 /path/privatekeyname.pem
    • /path/privatekey.pem is the location of the private key file





  • Set permissions on a private key file

    You will need to set the correct permissions on the private key file in order to use it to connect via SSH. 

    This involves setting read access to the current user only. If you do not set these permissions, then you cannot connect to your instance using this key pair.

    Steps

    On Linux:

    1. 1
      Open a terminal window on your computer.
    2. 2
      Open a terminal window on your computer.
    chmod 400 privatekeyname.pem

    On Windows:

    1. 1
      Open File Explorer and right-click on the .pem file.
    2. 2
      Select Properties > Security tab and choose Advanced.
    3. 3
      Choose Disable inheritance.
    4. 4
      Remove access to all users except for the current user.



Assist Note

You can use your private keys to connect to your cloud instances.