# Не меняется SSH-порт

Для изменения SSH-порта нужно выполнить следующие шаги:

1. Откройте `/etc/sshd_config` и раскомментируйте `Port 22`, если он закомментирован и замените 22 на желаемый порт.
2. Выполните `systemctl edit --full ssh.socket`. Если служба не найдена, то шаги 3-4 пропустите.
3. Измените значение параметра `ListenStream` на желаемый порт и сохраните файл.

<pre class="language-ini" data-full-width="false"><code class="lang-ini">[Unit]
Description=OpenBSD Secure Shell server socket
Before=ssh.service
Conflicts=ssh.service
ConditionPathExists=!/etc/ssh/sshd_not_to_be_run

[Socket]
<strong>ListenStream=22
</strong>Accept=yes

[Install]
WantedBy=sockets.target
</code></pre>

4. Перезагрузите данные служб:

```
systemctl daemon-reload
```

5. Перезапустите сервер SSH:

```bash
systemctl restart ssh
```

6. Готово!


---

# 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.pureservers.org/chastye-voprosy-i-problemy/ne-menyaetsya-ssh-port.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.
