> 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)

Подключение к MikoPBX по SSH с помощью Powershell (Terminal)

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

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="https://3704471835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPK4TuzRBnP7rt8htho-887967055%2Fuploads%2Fxw1WOoiBraxFNcVfjPaG%2FcreatedKeyPair.png?alt=media&amp;token=f4809457-8be5-4551-b2d5-31fe3973ff1b" 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="https://3704471835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPK4TuzRBnP7rt8htho-887967055%2Fuploads%2FvF49G4GZyZwRmwxlVRvp%2FDisplayedKey.png?alt=media&amp;token=296921cd-0e60-42ed-9100-124ea583696f" alt=""><figcaption><p>Полученный ключ</p></figcaption></figure>

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

<figure><img src="https://3704471835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPK4TuzRBnP7rt8htho-887967055%2Fuploads%2Fgit-blob-51785b085c70d80412ef71e5e063f1b25c5c0372%2FgeneralSettingsSection%20(1).png?alt=media" alt=""><figcaption><p>Раздел "Общие настройки"</p></figcaption></figure>

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

<figure><img src="https://3704471835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPK4TuzRBnP7rt8htho-887967055%2Fuploads%2FtqF8TTyy01JFd1hvxgXz%2Fsshauthorizedkey.png?alt=media&amp;token=4a9c3f39-5867-42b2-8c96-4b33083fd338" 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="https://3704471835-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MPK4TuzRBnP7rt8htho-887967055%2Fuploads%2Fgit-blob-005c40f7577958a1672ad3759692454709fef8b0%2FmikopbxconsoleSSH%20(1).png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
