> For the complete documentation index, see [llms.txt](https://docs.mikopbx.com/mikopbx/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mikopbx.com/mikopbx/faq/troubleshooting/connecting-to-a-pbx-using-ssh/terminal.md).

# Подключение с помощью SSH (Linux/MacOS)

## Создание и привязка ключа

1. Для начала необходимо сгенерировать SSH ключ. Перейдите в терминал и введите следующую комманду для его генерации:

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

В данном случае будет сгенерирован ключ типа "ed25519" с комментарием "<example.powershell@gmail.com>" - это поможет идентифицировать его в будущем.

Помимо этого, можно указать путь, куда будет сохранён файл с ключами, по умолчанию это "`~/.ssh/id_ed25519.pub`". Для этого добавьте -f и укажите путь, например:

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

<figure><img src="/files/g8JV53uSfeFBmv7eYL6s" alt=""><figcaption><p>Создание SSH ключа</p></figcaption></figure>

{% hint style="info" %}
По умолчанию ключ сохраняется в Username/.ssh/id\_ed25519.pub
{% endhint %}

2. Далее необходимо получить и скопировать созданный публичный ключ. Для этого введем команду:

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

<figure><img src="/files/LmjBAm2jrohwTUkgLMyQ" alt=""><figcaption><p>Полученный ключ</p></figcaption></figure>

3. Перейдите в "**Система**" -> "**Общие настройки**" в web-интерфейсе MikoPBX.

<figure><img src="/files/u610VS6hPiczbHSqwWti" alt=""><figcaption><p>Раздел "Общие настройки"</p></figcaption></figure>

4. Вставьте ваш ключ в поле "**SSH Authorized Keys**":

<figure><img src="/files/DHiCLFzFs56SGjuCIO09" alt=""><figcaption><p>Поле "<strong>SSH Authorized Keys</strong>"</p></figcaption></figure>

## Подключение с помощью SSH

Для подключения по SSH выполните следующую команду в Terminal:

```
ssh -i Users\<Username>\.ssh\id_ed25519 root@mikopbxipadress
```

Замените следующие данные, исходя из ваших параметров:

* Путь к SSH ключу.
* Подставьте IP вашей MikoPBX вместо *mikopbxipadress.*

Произойдет подключение к консоли MikoPBX с помощью SSH:

<figure><img src="/files/XWVpeoz3r7pwCcx1nN1m" alt=""><figcaption><p>Успешное подключение!</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.mikopbx.com/mikopbx/faq/troubleshooting/connecting-to-a-pbx-using-ssh/terminal.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
