- Установка ssh oracle linux 7
- Setting Up SSH on UNIX and Linux Systems
- To Set Up SSH on Oracle Solaris Systems
- To Set Up SSH on MacOS Systems
- To Set Up SSH on Linux systems
- Установка и настройка сервера SSH в Linux
- Установка пакетов SSH
- Настройка SSH
- ChapterВ 9В Configuring the VNC Service
- 9.1В About VNC
- 9.2В Configuring a VNC Server
- 9.3В Connecting to VNC Desktop
Установка ssh oracle linux 7
Setting Up SSH on UNIX and Linux Systems
Setting up SSH on UNIX and Linux systems involves verifying that the SSH server daemon sshd is running and, if necessary, starting this daemon. Set up SSH on the DAS host and on all hosts where instances in your cluster will reside.
On UNIX and Linux systems, SSH software is typically installed as part of the base operating system. If SSH is not installed, download and install the appropriate OpenSSH SSH package for your operating system.
How to set up SSH on UNIX and Linux systems depends on the flavor of the operating system that you are running, as explained in the following sections:
To Set Up SSH on Oracle Solaris Systems
- Ensure that the following options in the configuration file /etc/ssh/sshd_config are set to yes:
If the daemon is running, no further action is required.
Example 2-2 Determining if the sshd Daemon Is Running on an Oracle Solaris System
This example confirms that the SSH server daemon sshd is running on an Oracle Solaris system.
After you have completed the setup of SSH on a host, test the setup on the host as explained in Testing the SSH Setup on a Host.
To Set Up SSH on MacOS Systems
- Open System Preferences and click Sharing.
The Sharing window opens.
The user that running the DAS or instance
After you have completed the setup of SSH on a host, test the setup on the host as explained in Testing the SSH Setup on a Host.
To Set Up SSH on Linux systems
- Ensure that the following options in the configuration file /etc/ssh/sshd_config are set to yes:
If the daemon is running, no further action is required.
Example 2-3 Determining if the sshd Daemon Is Running on a Linux System
This example confirms that the SSH server daemon sshd is running on a Linux system.
After you have completed the setup of SSH on a host, test the setup on the host as explained in Testing the SSH Setup on a Host.
Источник
Установка и настройка сервера SSH в Linux
Secure Shell, т. е. SSH – протокол, обеспечивающий защищённые соединения и передачу данных между двумя удалёнными компьютерами. Изначально создавался на замену таким системам как rlogin и rcp. Как понятно из полного названия протокола, система SSH позволяет соединяться и управлять удалённым узлом (компьютером, маршрутизатором и т. д.), при этом защищая весь передаваемый трафик с помощью высоконадёжного шифрования.
SSH широко применяется администраторами серверов для их настройки и управления, да и обычные продвинутые пользователи — владельцы, например, сайтов или виртуальных серверов активно используют SSH для подключения к своей учётной записи на хостинге и использования командной оболочки сервера.
Сразу после окончания разработки система SSH стала активно трансформироваться в закрытый коммерческий продукт в виде версии SSH2. Но благодаря сообществу GNU версии протокола SSH1 и SSH2 были реализованы в виде открытого и свободно распространяемого ПО openSSH. В Linux-системах используется именно этот метапакет.
Метапакет SSH базово включает в себя сервер SSH (sshd) в качестве програмы-демона, а также несколько утилит: ssh – удаленная регистрация и выполнение команд, scp – передача файлов и ssh-keygen – для генерации пар SSH-ключей.
Установка пакетов SSH
Как уже говорилось система ssh в Linux-системах распространяется в виде составного метапакета, поэтому для установки всех требуемых утилит ssh нужно выполнить всего одну команду:
В Ubuntu
После чего начнется процесс установки
Как видно, менеджер пакетов сам распознает все зависимые и связанные пакеты и установит их. Также, по завершению установки, автоматически будет запущен SSH-сервер в режиме демона. Это можно проверить командой:
$ systemctl status sshd
или:
$ service sshd status даст тот же вывод. Теперь сервер работает с базовыми настройками по-умолчанию.
Настройка SSH
Режим работы SSH-сервера с настройками по-умолчанию хоть и является вполне работоспособным для небольших частных сетей, всё же нуждается в задании некоторых важных параметров для использования на высоконадёжных публичных серверах. Настройки демона хранятся в файле /etc/ssh/sshd_config. Посмотреть его можно командой
В первую очередь следует обратить внимание на следующие параметры: Port, AddressFamily, ListenAddress. Первый глобально задаёт номер порта, через который будет работать соединение и если оставить его стандартным, т. е. 22, то велика вероятность, что он будет слишком часто сканироваться роботами.
Примечание: для задания активации параметра необходимо раскомментировать соответствующую строку — убрать символ «#» в её начале.
Второй параметр задаёт семейство используемых IP-адресов — IPv4 и IPv6. Если, к примеру, используются только адреса IPv4, то очень рекомендуется установить для параметра
Для адресов семейства IPv6 используется значение inet6.
Параметр ListenAddress позволяет задавать порты для отдельных сетевых интерфейсов:
Поскольку реализация openSSH позволяет работать с протоколами SSH1 и SSH2, то разумно отключить использование SSH1, т. к. эта версия является устаревшей. Работа по SSH1 крайне не рекомендуется: Protocol 2
Очень полезным является параметр, позволяющий проводить авторизацию и шифрование трафика с помощью специальных SSH-ключей:
Следует заметить, что в таком случае серверу необходимо явно указывать, где хранятся открытые ключи пользователей. Это может быть как один общий файл для хранения ключей всех пользователей (обычно это файл etc/.ssh/authorized_keys), так и отдельные для каждого пользователя ключи. Второй вариант предпочтительнее в силу удобства администрирования и повышения безопасности:
AuthorizedKeysFile etc/ssh/authorized_keys # Для общего файла
AuthorizedKeysFile %h/.ssh/authorized_keys # Файл -> пользователь
Во втором варианте благодаря шаблону автоподстановки с маской «%h» будет использоваться домашний каталог пользователя.
Важно также отключать парольный доступ:
Или же, в случае, если всё-таки необходимо использовать доступ по паролю, то обязательно нужно отключать авторизацию по пустому паролю:
Для указания разрешённых или запрещённых пользователей и групп служат директивы DenyUsers, AllowUsers, DenyGroups, и AllowGroups. Значениями для них являются списки имён, разделяемых пробелами, например:
Следует также отключать root-доступ:
Иногда, когда следует задавать мультисерверную конфигурацию, очень удобно использовать алиасы (Aliases), что позволяет настроить сразу несколько режимов доступа (с разными хостами, портами и т. д.) и использовать их, указывая при этом конкретный алиас:
Настройки для алиасов хранятся либо глобально в /etc/ssh/ssh_config, либо раздельно для пользователей в
/.ssh/config. Здесь нужно не спутать с ssh_config! Пример:
Для применения сделанных настроек необходим перезапуск SSH-сервера:
Настройка и использование клиента SSH
Для подключения по к серверу используется команда:
где user_name – имя пользователя в системе, host_name – имя узла, к которому производится подключение, например:
При этом утилита ssh запросит (в зависимости от настроек сервера) логин, пароль или парольную фразу для разблокировки приватного ключа пользователя.
В случае авторизации по ключу, должна быть предварительно сгенерирована пара SSH-ключей — открытый, который хранится на стороне сервера, обычно в файле .ssh/authorized_keys в домашнем каталоге пользователя, и закрытый — используется для авторизации клиента и хранится, как правило, в каталоге .ssh/ домашней директории пользователя. Открытый ключ представляет собой «цифровой слепок» закрытого ключа благодаря которому сервер «знает», кто «свой», а кто «чужой».
Для генерации ключей используется утилита ssh-keygen:
Утилита предложит выбрать расположение ключей (лучше всё оставить по-умолчанию), обычно это каталог
/.ssh/, ввести парольную фразу для закрытого ключа. После чего будут сгенерированы открытый ключ id_rsa.pub и закрытый — id_rsa. Теперь нужно скопировать открытый ключ, т. е. «слепок» закрытого на сервер. Проще всего этого можно добиться командой:
Теперь можно выполнить подключение командой ssh и запустить защищённый сеанс удалённого управления.
Важно заметить, что использование сгенерированных openSSH-ключей несовместимо с PPK-форматом, используемым по-умолчанию в таких комплексах как PuTTY. Поэтому необходимо конвертировать имеющиеся openSSH-ключи в формат PPK. Удобнее всего это делать с помощью утилиты PuTTY – puttygen.exe.
Если вы нашли ошибку, пожалуйста, выделите фрагмент текста и нажмите Ctrl+Enter.
Источник
ChapterВ 9В Configuring the VNC Service
This chapter describes how to enable a Virtual Network Computing (VNC) server to provide remote access to a graphical desktop.
9.1В About VNC
Virtual Network Computing (VNC) is a system for sharing a graphical desktop over a network. A VNC client (the «viewer») connects to, and can control, a desktop that is shared by a VNC server on a remote system. Because VNC is platform independent, you can use any operating system with a VNC client to connect to a VNC server. VNC makes remote administration using graphical tools possible.
By default, all communication between a VNC client and a VNC server is not secure. You can secure VNC communication by using an SSH tunnel. Using an SSH tunnel also reduces the number of firewall ports that need to be open. Oracle recommends that you use SSH tunnels.
9.2В Configuring a VNC Server
To configure a VNC server:
Install the tigervnc-server package:
Create the VNC environment for the VNC users.
Each VNC desktop on the system runs a VNC server as a particular user. This user must be able to log in to the system with a user name and either a password or an SSH key (if the VNC desktop is to be accessed through an SSH tunnel).
Use the vncpasswd command to create a password for the VNC desktop. The password must be created by the user that runs the VNC server and not root , for example:
The password must contain at least six characters. If the password is longer than eight characters, only the first eight characters are used for authentication. An obfuscated version of the password is stored in $HOME/.vnc/passwd unless the name of a file is specified with the vncpasswd command.
Create a service unit configuration file for each VNC desktop that is to be made available on the system.
Copy the vncserver@.service template file, for example:
In the previous command, display is the unique display number of the VNC desktop, starting from 1 . Use a backslash character ( \ ) to escape the colon ( : ) character.
Each VNC desktop is associated with a user account. For ease of administration if you have multiple VNC desktops, you can include the name of the VNC user in the name of the service unit configuration file, for example:
Edit the service unit configuration files.
The following sections in the configuration file should resemble the sample entries. Replace vncuser with the actual VNC user name.
Optionally, you can add command-line arguments for the VNC server. In the following example, the VNC server only accepts connections from localhost , which means the VNC desktop can only be accessed locally or through an SSH tunnel; and the size of the window has been changed from the default 1024×768 to 640×480 using the geometry flag:
Start the VNC desktops.
Make systemd reload its configuration files:
For each VNC desktop, start the service, and configure the service to start after a system reboot. Remember to use the username and the display number that you specified in the service unit configuration file to be associated with that service. For example:
If you make any changes to a service unit configuration file, you must reload the configuration file and restart the service.
Configure the firewall to allow access to the VNC desktops.
If users will access the VNC desktops through an SSH tunnel and the SSH service is enabled on the system, you do not need to open additional ports in the firewall. SSH is enabled by default. For information on enabling SSH, see Oracle В® Linux: Connecting to Remote Systems With OpenSSH.
If users will access the VNC desktops directly, you must open the required port for each desktop. The required ports can be calculated by adding the VNC desktop service display number to 5900 (the default VNC server port). So if the display number is 1, the required port is 5901 and if the display number is 67, the required port is 5967.
To open ports 5900 to 5903, you can use the following commands:
To open additional ports, for example port 5967, use the following commands:
Configure the VNC desktops.
By default, the VNC server runs the user’s default desktop environment. This is controlled by the VNC user’s $HOME/.vnc/xstartup file, which is created automatically when the VNC desktop service is started.
If you did not install a desktop environment when you installed the system (for example because you selected Minimal Install as the base environment), you can install one with the following command:
When the installation is complete, use the systemctl get-default command to check that the default system state is multi-user.target (multi-user command-line environment). Use the systemctl set-default command reset the default system state or to change it to the graphical.target (multi-user graphical environment) if you prefer.
The $HOME/.vnc/xstartup file is a shell script that specifies the X applications to run when the VNC desktop is started. For example, to run a KDE Plasma Workspace, you could edit the file as follows:
If you make any changes to a user’s $HOME/.vnc/xstartup file, you must restart the VNC desktop for the changes to take effect:
See the vncserver(1) , Xvnc(1) , and vncpasswd(1) manual pages for more information.
9.3В Connecting to VNC Desktop
You can connect to a VNC desktop on an Oracle Linux 7 system using any VNC client. The following example instructions are for the TigerVNC client. Adapt the instructions for your client.
Install the TigerVNC client ( vncviewer ).
Start the TigerVNC client and connect to a desktop.
To connect directly to a VNC desktop, you can start the TigerVNC client and enter host : display to specify the host name or IP address of the VNC server and the display number of the VNC desktop to connect to. Alternatively, you can specify the VNC desktop as an argument for the vncviewer command. For example:
To connect to a VNC desktop through an SSH tunnel, use the -via option for the vncviewer command to specify the user name and host for the SSH connection, and use localhost: display to specify the VNC desktop. For example:
See the vncviewer(1) manual page for more information.
Copyright В© 2020, 2021, Oracle and/or its affiliates. Legal Notices
Источник