# How to configure additional SSH keys to your public cloud instance?

{% embed url="<https://youtu.be/FofwTKxaPT0>" %}

### **Overview**&#x20;

Only one SSH key can be set up when creating an instance for the initial connection. To allow other users to access your instance, additional keys can be added by configuring the authorized keys file.&#x20;

In the [previous article](https://customer.acecloudhosting.com/index.php?rp=/knowledgebase/95/How-to-setup-SSH-keys-in-Ubuntu-20.04..html), the user generated a key on one server, used SSH copy id to paste the key on the second server. Then accessed the second server from the first server itself.&#x20;

This guide explains how to configure additional SSH keys for connections to your instance.&#x20;

### **Prerequisites**

There are certain prerequisites that need to be met before you begin:

* A Public Cloud Instance&#x20;
* Administrative access (root) to your instance via SSH&#x20;
* Access to Openstack Portal GUI&#x20;
* Second server to access the user account&#x20;

### **Get Started**

**Step 1: Create a new public cloud instance**&#x20;

Click [here](https://customer.acecloudhosting.com/index.php?rp=/knowledgebase/33/How-to-create-compute-instance.html) to learn how to create a new public cloud instance.&#x20;

**Step 2: Generate a new SSH keypair to your instance**&#x20;

Enter the below command to generate a new key pair. &#x20;

```
ssh-keygen
```

<img src="http://customer.acecloudhosting.com/index.php?rp=/images/kb/1055_1.-Addkey.png" alt="" height="450" width="800">

**Step 3:** You can now enter a file path or press enter to select default path (\~/. ssh directory) to save your keypair.&#x20;

<figure><img src="http://customer.acecloudhosting.com/index.php?rp=/images/kb/1056_2.-key-path.png" alt=""><figcaption></figcaption></figure>

**Step 4:** If you want to overwrite your existing key, enter Y. This process is not reversable.&#x20;

<figure><img src="http://customer.acecloudhosting.com/index.php?rp=/images/kb/1057_3.-overwrite.png" alt=""><figcaption></figcaption></figure>

**Step 5:** Your keypair’s fingerprint and random art image is now generated.

&#x20;

<figure><img src="http://customer.acecloudhosting.com/index.php?rp=/images/kb/1058_4.-fingerprint-image.png" alt=""><figcaption></figcaption></figure>

**Step 6:** Navigate to your .sh directory using the below command to access/view your keys:&#x20;

```
cd .ssh
```

<img src="http://customer.acecloudhosting.com/index.php?rp=/images/kb/1059_5.-Directory.png" alt="" height="448" width="800">

**Step 7:** Enter **ls** to view the files present in the above directory.&#x20;

You will now see two key files listed in the directory&#x20;

**id\_rsa** – Private authorized key of the pair.&#x20;

**Id\_rsa.pub** - Public authorized key of the pair.&#x20;

<figure><img src="http://customer.acecloudhosting.com/index.php?rp=/images/kb/1060_6.-ls.png" alt=""><figcaption></figcaption></figure>

**Step 8:** Enter the below command to view and copy the id\_rsa.pub file (public authorized key).&#x20;

```
cat id_rsa.pub 
```

<img src="http://customer.acecloudhosting.com/index.php?rp=/images/kb/1061_7.-id_rsa.pub.png" alt="" height="448" width="800">

**Step 9:** Copy the public authorized key and paste it in the authorized\_keys folder (home/user/.ssh/authorized\_keys). Enter the below command to make changes in authorized\_keys file.&#x20;

```
nano authorized_keys 
```

<img src="http://customer.acecloudhosting.com/index.php?rp=/images/kb/1062_8.-copy.png" alt="" height="448" width="800">

<img src="http://customer.acecloudhosting.com/index.php?rp=/images/kb/1063_9.-private-key.png" alt="" height="377" width="800">

**Step 10:** Enter the below command to access the private authorized key (id\_rsa), copy and save the key in your local system (save the file in pem format).&#x20;

{% hint style="warning" %}
**Note:** This will be the additional key that will be used to access this server.&#x20;
{% endhint %}

```
cat id_rsa 
```

<img src="http://customer.acecloudhosting.com/index.php?rp=/images/kb/1064_10.-private-auth-key.png" alt="" height="410" width="800">

**Step 11:** Now open a new session and access the same server using the new additional key.&#x20;

<figure><img src="http://customer.acecloudhosting.com/index.php?rp=/images/kb/1065_11.-new-session.png" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.acecloud.ai/knowledge-base/tutorials/how-to-configure-additional-ssh-keys-to-your-public-cloud-instance.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
