> For the complete documentation index, see [llms.txt](https://spacecore.gitbook.io/wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://spacecore.gitbook.io/wiki/ua/os-and-software/disabling-password-access-to-linux.md).

# Відключення доступу до Linux за допомогою пароля

Якщо ви використовуєте SSH ключі, відключення доступу до сервера через пароль буде корисним додатковим заходом безпеки для вас.

## Вимкнення через nano

Використовуйте наступну команду:

```
nano /etc/ssh/sshd_config
```

Ми потрапляємо в конфігураційний файл sshd.

<figure><img src="/files/N5mFtAmPEQ1JlpQZLffQ" alt=""><figcaption></figcaption></figure>

Знаходимо рядок `PasswordAuthentication yes`

<figure><img src="/files/qvCXGyEKyWH5eMwhjxEh" alt=""><figcaption></figcaption></figure>

Нам потрібно видалити символ решітки (#), щоб рядок став активним. Потім змінюємо значення `yes` на `no`.

<figure><img src="/files/sq0GehcGIEKPtIFaHv8G" alt=""><figcaption></figcaption></figure>

Натискаємо Ctrl + X, вводимо Y для збереження.

#### Перезапуск служби SSH:

```
sudo service ssh restart
```

## Вимкнення через sFTP

У панелі над файловим менеджером потрібно стерти стандартний шлях `/root` та вказати `/etc/ssh`&#x20;

У цій директорії нам потрібно відкрити файл `sshd_config`.&#x20;

Знаходимо відповідний рядок `PasswordAuthentication yes`.

<figure><img src="/files/8sCNdHGNLAkaMsAqPPNF" alt=""><figcaption></figcaption></figure>

Видаляємо символ решітки (#), щоб рядок став активним. Потім змінюємо значення `yes` на `no`.

<figure><img src="/files/AQT5vri7ijm2NOIZ7LdV" alt=""><figcaption></figcaption></figure>

Зберігаємо файл і відправляємо його на сервер.

## Перезапуск служби SSH:

```
sudo service ssh restart
```

## Використання SSH ключа в sFTP

Після увімкнення доступу лише через SSH ключ може виникнути проблема при підключенні через sFTP, яку дуже просто вирішити.

### FileZilla

Натисніть на категорію Edit і виберіть Settings&#x20;

Потім виберіть сторінку sFTP та натисніть кнопку Add Key File.&#x20;

Виберіть місцезнаходження та додайте файл.&#x20;

Ключ додано, тепер FileZilla враховуватиме його при спробі підключення до серверів.

### WinSCP

Натисніть на кнопку створення нового з'єднання: Відкриється вікно.&#x20;

Тут ми вказуємо IP-адресу сервера та ім'я користувача.&#x20;

Використовуйте кнопку More під рядком Password.&#x20;

У вікні, що відкриється, виберіть розділ Authentication.&#x20;

Додайте приватний ключ та натисніть OK.&#x20;

Ми намагаємося підключитися до сервера.&#x20;

Програма запитує код секретного ключа, вводимо spacecore: Ми підключилися до сервера!


---

# 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://spacecore.gitbook.io/wiki/ua/os-and-software/disabling-password-access-to-linux.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.
