# продолжение 5

#### Задание:

Доделать следующие пункты:

* b. Запретите парольную аутентификацию. Аутентификация пользователя sshuser должна происходить только при помощи ключей.
* c. Измените стандартный ssh порт на 2023.
* d. На CLI-HQ сконфигурируйте клиент для автоматического подключения к SRV-HQ и SRV-BR под пользователем sshuser. При подключении автоматически должен выбираться корректный порт. Создайте пользователя sshuser на CLI-HQ для обеспечения такого сетевого доступа.

#### Выполнение:

**CLI-HQ:**

* Создаём пользователя **sshuser** с паролем **P\@ssw0rd**:
  * открываем **Меню** далее **Администрирование,** затем **Центр управления системой**:

![](https://sysahelper.ru/pluginfile.php/222/mod_page/content/3/image.png)

* * вводим пароль пользователя **root** нажимаем **ОК**:

![](https://sysahelper.ru/pluginfile.php/222/mod_page/content/3/image%20%281%29.png)

* * в разделе **Пользователя** выбираем **Локальные учётные записи**:

![](https://sysahelper.ru/pluginfile.php/222/mod_page/content/3/image%20%282%29.png)

* вводим имя пользователя **sshuser** нажимаем **Создать**:

![](https://sysahelper.ru/pluginfile.php/222/mod_page/content/3/image%20%283%29.png)

* задаём **пароль** - **P\@ssw0rd** для пользователя **sshuser** и нажимаем применить:

<img src="https://sysahelper.ru/pluginfile.php/222/mod_page/content/3/image%20%284%29.png" alt="" height="553" width="1026">

* Выполняем вход из под пользователя **sshuser**:

<img src="https://sysahelper.ru/pluginfile.php/222/mod_page/content/3/image%20%285%29.png" alt="" height="604" width="1023">

![](https://sysahelper.ru/pluginfile.php/222/mod_page/content/3/image%20%286%29.png)

* генерируем ключевую пару для доступа по **ssh**:

```
ssh-keygen -t rsa
```

![](https://sysahelper.ru/pluginfile.php/222/mod_page/content/3/image%20%287%29.png)

* настраиваем клиент для автоматического подключения к **SRV-HQ** и **SRV-BR** под пользователем **sshuser:**

```
vim .ssh/config
```

![](https://sysahelper.ru/pluginfile.php/222/mod_page/content/3/image%20%288%29.png)

где:

**Host** - имя для подключения, таким образом будет достаточно выполнить команду: ***ssh srv-hq.company.prof*****&#x20;-** для подключения к **SRV-HQ** под пользователем **sshuser** используя **2023** порт

* передаём публичный ключ на **SRV-HQ**:

```
ssh-copy-id sshuser@10.0.10.2
```

![](https://sysahelper.ru/pluginfile.php/222/mod_page/content/3/image%20%289%29.png)

#### SRV-HQ:

в конфигурационной файле **/etc/openssh/sshd\_config** - правим параметры в соответствии с [задание](https://sysahelper.ru/mod/resource/view.php?id=176)м:

```
vim /etc/openssh/sshd_config
```

* * меняем стандартный порт (22) на порт **2023**;

![](https://sysahelper.ru/pluginfile.php/222/mod_page/content/3/image%20%2810%29.png)

* * разрешаем аутентификацию по **ключу**:
  * запрещаем **парольную аутентификацию**;

![](https://sysahelper.ru/pluginfile.php/222/mod_page/content/3/image%20%2811%29.png)

* Перезапускаем службу **sshd**:

```
systemctl restart sshd
```

* Проверяем:
  * работа **ssh** на порту **2023**:&#x20;

![](https://sysahelper.ru/pluginfile.php/222/mod_page/content/3/image%20%2812%29.png)

* * подключение с клиента:

![](https://sysahelper.ru/pluginfile.php/222/mod_page/content/3/image%20%2813%29.png)

* передаём публичный ключ на **SRV-BR**:

```
ssh-copy-id sshuser@10.0.20.2
```

![](https://sysahelper.ru/pluginfile.php/222/mod_page/content/3/image%20%2814%29.png)

#### SRV-BR:

Аналогично **SRV-HQ,** результат:

![](https://sysahelper.ru/pluginfile.php/222/mod_page/content/3/image%20%2815%29.png)

Последнее изменение: понедельник, 5 февраля 2024, 18:17


---

# 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://seraphim.gitbook.io/volodyazetkin2024gitbook/2024-modul-b-1.-bazovaya-nastroika/prodolzhenie-5.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.
