# SSH Connection (Linux/MacOS Terminal)

## Generating and Linking the Key

1. First, generate an SSH key. Open a terminal and enter the following command to create it:

```
ssh-keygen -t ed25519 -C "example.powershell@gmail.com"
```

In this example, an "ed25519" key will be generated with the comment "<example.powershell@gmail.com>" for future identification.

You can also specify a path where the key files will be saved. By default, keys are stored in `~/.ssh/id_ed25519.pub`. To set a custom path, add `-f` and specify it, for example:

```
ssh-keygen -t ed25519 -f ~/.ssh/my_new_key
```

<figure><img src="/files/PnX6tZHj3dHBWHvnVDVl" alt=""><figcaption><p>Creating the SSH Keys (pair)</p></figcaption></figure>

{% hint style="info" %}
By default, the key is saved at `Username/.ssh/id_ed25519.pub on macOS or /home/Username/.ssh/id_ed25519.pub` on Linux.
{% endhint %}

2. Next, you need to retrieve and copy the newly created public key. Enter the command:

```
cat ~/.ssh/id_ed25519.pub
```

<figure><img src="/files/x89pGjvAfSLXPNeztroF" alt=""><figcaption><p>Public key</p></figcaption></figure>

3. Open the MikoPBX web interface and go to **System** → **General Settings**:
4. Paste your public key into the **"SSH Authorized Keys"** field:

<figure><img src="/files/a3vapmES1cvh9N3IOmdN" alt=""><figcaption><p>SSH Authorized Keys Field</p></figcaption></figure>

## Connecting via SSH

To connect via SSH, run the following command in your terminal:

```
ssh -i ~/.ssh/id_ed25519 root@mikopbxipadress
```

Replace the following with your actual parameters:

* The path to your SSH key (if different from default).
* The IP address of your MikoPBX in place of `mikopbxipadress`.

Upon successful authentication, you will be connected to the MikoPBX console via SSH:

<figure><img src="/files/FFjyFxt1HLYTmoqLrucT" alt=""><figcaption><p>Successful connection!</p></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.mikopbx.com/mikopbx/english/faq/troubleshooting/connecting-to-a-pbx-using-ssh/terminal.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.
