> For the complete documentation index, see [llms.txt](https://utm-1.gitbook.io/utm-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://utm-1.gitbook.io/utm-docs/dokumentaciya/utm-it/programmnoe-obespechenie/linux-servera/nastroiki/nastroika-dostupov.md).

# Настройка доступов

## Новый пользователь

```bash
sudo su
adduser andrew

groups

usermod -aG sudo andrew
usermod -aG adm andrew
usermod -aG cdrom andrew
usermod -aG dip andrew
usermod -aG plugdev andrew
usermod -aG lpadmin andrew
```

## Доступ пользователей по SSH

### Установка и настройка SSH сервера

Шаг 1: Установка и включение SSH-сервера

```bash
sudo apt update
sudo apt install openssh-server
sudo systemctl enable ssh
```

Шаг 2: Настройка брандмауэра

```bash
# Разрешите входящие соединения на стандартный порт SSH (22) с помощью команды
sudo ufw allow ssh
# Если брандмауэр неактивен, активируйте его
sudo ufw enable
```

Шаг 3: Изменение порта доступа по SSH

```bash
# Сделайте резервную копию файла конфигурации
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak
# Отредактируйте файл конфигурации
sudo nano /etc/ssh/sshd_config
# Найдите строку #Port 22 или Port 22. Если она закомментирована (начинается с #), уберите символ решетки.
# Необходимо указать:

Port 5022
PermitRootLogin no
PubkeyAuthentication yes
PasswordAuthentication yes


# Проверьте, не занят ли новый порт (вывод должен быть пустым)
sudo ss -lptun | grep 5022
# Откройте новый порт в брандмауэре
sudo ufw allow 5022
# Перезагрузите правила брандмауэра:
sudo ufw reload
```

Шаг 4: Перезапуск службы SSH

```bash
sudo systemctl restart ssh
```

### Прописывание публичных ключей доступа

Для пользователей необходимо прописать их публичные ключи доступа в файле `$HOME/.ssh/authorized_keys`

```bash
sudo nano $HOME/.ssh/authorized_keys
```

## Доступ пользователей по RDP

### Установка и настройка пакета xrdp

```bash
# Установка
sudo apt update
sudo apt install xrdp -y

# Добавить пользователя xrdp в группу ssl-cert
sudo usermod -aG ssl-cert xrdp
# Группы пользователя xrdp
groups xrdp

# Запуск
sudo systemctl status xrdp

sudo systemctl enable xrdp

# Тут обязательно выбрать gme3
sudo apt install xfce4

sudo systemctl start xrdp

# Настройка брандмауэра
sudo ufw allow 3389/tcp
sudo ufw reload

# Перезапуск службы
sudo systemctl restart xrdp
```

#### Возможные проблемы

[Тут](https://losst.pro/ustanovka-xrdp-v-ubuntu-20-04) описано решение некоторых возможных проблем.

[Вот тут](https://ru.stackoverflow.com/questions/1583423/%D0%A7%D0%B5%D1%80%D0%BD%D1%8B%D0%B9-%D1%8D%D0%BA%D1%80%D0%B0%D0%BD-%D0%BF%D0%BE%D1%81%D0%BB%D0%B5-%D0%BF%D0%BE%D0%B4%D0%BA%D0%BB%D1%8E%D1%87%D0%B5%D0%BD%D0%B8%D1%8F-%D0%B8%D0%B7-windows-%D0%BA-ubuntu-22-04-%D0%BF%D0%BE-%D0%BF%D1%80%D0%BE%D1%82%D0%BE%D0%BA%D0%BE%D0%BB%D1%83-xrdp) совет с xfce4 помог с проблемой черного экрана на utm-server5

### Дополнительные настройки

Settings - System - Remote Desktop - Desktop Sharing

* Desktop Sharing = yes
* Remote Control = yes
* Hostname
* Port = 3390 (если другой и нет возможности поменять, то нужно перейти на вкладку Remote Login, включить Remote Login = yes, там будет использован порт 3389 без возможности редактирования, а на вкладке Desktop Sharing порт поменяется на 3390, при этом Remote Login потом можно выключить Remote Login = no, а порт Desktop Sharing останется 3390)

Settings - System - Remote Desktop - Desktop Sharing

* Remote Login = no


---

# 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:

```
GET https://utm-1.gitbook.io/utm-docs/dokumentaciya/utm-it/programmnoe-obespechenie/linux-servera/nastroiki/nastroika-dostupov.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.
