> 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/powershell.md).

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

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

Для начала необходимо произвести установку OpenSSH. Сделать это можно [по ссылке](https://github.com/PowerShell/Win32-OpenSSH/releases).

1. После установки необходимо проверить ее корректность. Для этого введите следующую команду в Powershell:

```
ssh -V
```

У Вас должна отобразиться версия OpenSSH:

<figure><img src="/files/prZ1DtIny39rddNy6JeM" alt=""><figcaption><p>Версия OpenSSH</p></figcaption></figure>

{% hint style="info" %}
В случае, если при вводе команды для проверки версии ничего не произошло, Вы можете ввести - `Add-WindowsCapability -Online -Name OpenSSH.Client*`
{% endhint %}

2. Далее необходимо сгенерировать SSH ключ, для этого введем следующую команду:

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

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

Помимо этого, можно указать путь, куда будет сохранён файл с ключами, по умолчанию это\
"**C:\Users\<Username>.ssh\id\_ed25519**". Для этого добавьте -f и укажите путь, например:

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

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

После этого, ключ будет создан в указаной директории. В одном файле будет располагаться публичный ключ, а в другом - приватный.

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

3. Введем команду для получения публичного Ssh-ключа:

```
Get-Content ~/.ssh/id_ed25519.pub
```

Скопируйте его.

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

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

5. Перейдите в раздел "**SSH**" и вставьте публичный ключ в поле "**SSH Authorized Keys**" в формате:

```
Тип ключа
Ключ
```

Нажмите "**Сохранить**":

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

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

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

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

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

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

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

<figure><img src="/files/gm7Aa2DXhHNCGplGh7Ac" 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/powershell.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.
