- Руководство: SSH в Терминале Windows Tutorial: SSH in Windows Terminal
- Создание профиля Create a profile
- Указание начального каталога Specify starting directory
- Run SSH Command
- Configuring the Run SSH Command Activity
- Details
- Advanced
- Published Data
- Next steps
- Выполнение команды SSH Run SSH Command
- Настройка действия «Запуск команды SSH» Configuring the Run SSH Command Activity
- Сведения Details
- Продвинутый уровень Advanced
- Опубликованные данные Published Data
- Следующие шаги Next steps
Руководство: SSH в Терминале Windows Tutorial: SSH in Windows Terminal
В Windows 10 встроен клиент SSH, который можно использовать в Терминале Windows. Windows 10 has a built-in SSH client that you can use in Windows Terminal.
В этом руководстве содержатся сведения о настройке профиля в Терминале Windows, использующем SSH. In this tutorial, you’ll learn how to set up a profile in Windows Terminal that uses SSH.
Создание профиля Create a profile
Вы можете запустить сеанс SSH в командной строке, выполнив ssh user@machine . После этого вам будет предложено ввести пароль. You can start an SSH session in your command prompt by executing ssh user@machine and you will be prompted to enter your password. Вы можете создать профиль Терминала Windows, выполняющий этот процесс при запуске, добавив параметр commandline в профиль в файле settings.json file. You can create a Windows Terminal profile that does this on startup by adding the commandline setting to a profile in your settings.json file.
Указание начального каталога Specify starting directory
Чтобы указать начальный каталог для сеанса SSH, вызываемого с помощью Терминала Windows, можно использовать следующую команду: To specify the starting directory for a ssh session invoked by Windows Terminal, you can use this command:
Флаг -t приводит к выделению псевдотерминала. The -t flag forces pseudo-terminal allocation. Эту возможность можно использовать для выполнения произвольных интерактивных программ на удаленном компьютере, например при реализации служб меню. This can be used to execute arbitrary screen-based programs on a remote machine, e.g. when implementing menu services. Вам потребуется использовать экранированные двойные кавычки, так как производные оболочки Bourne shell не выполняют дополнительную обработку строки в одинарных кавычках. You will need to use escaped double quotes as bourne shell derivatives don’t do any additional parsing for a string in single quotes.
Дополнительная информация: For more information, see:
Run SSH Command
This version of Orchestrator has reached the end of support, we recommend you to upgrade to Orchestrator 2019.
The Run SSH Command activity opens an SSH connection to a remote server and runs shell commands on that server. Use the Run SSH Command activity to run backup applications or a batch script that runs a set of complex commands on a non-Windows computer. The Run SSH Command activity can run any command in a Secure Shell.
Run SSH Command activity is based on PuTTY beta .70. The implementation of SSH in «Run SSH Command» has certain limitations:
The Run SSH Command activity does not work against all SSH-1 and SSH-2 servers. In general, this activity functions with most SSH servers, but it does not work for all SSH server implementations.
You must download and use the PuTTy key generation tool to create keys for the Run SSH Command activity. The key generation tool is available at Download PuTTY — a free SSH and telnet client for Windows.
The Run SSH Command activity supports SSH-1. Microsoft does not recommend the use of SSH-1. If you want to prevent The Run SSH Command activity from using SSH-1, you should use a key file that contains keys that do not support SSH-1. Do not use a username and password pair use a key file.
The property Accept Host Key Change is not a recommended setting. This property should only be used to establish the initial connection to a computer when the key is stored on the runbook server. Runbooks that contain the Run SSH Command activity should be configured with Accept Host Key Change disabled. When you use this property it disables the validation of the identity of the SSH server and represents a security risk.
You should review the list if cryptographic ciphers supported by PuTTY, which is found at [https://the.earth.li/
PuTTY beta .61 uses a pseudorandom number generator suitable for most cryptographic purposes. It is not recommended for the generation of long-term cryptographic keys.
Configuring the Run SSH Command Activity
Before you configure the Run SSH Command activity, you need to determine the following:
Connection information for the computer that hosts the SSH server that you want to connect to.
Commands that you want to run.
Whether you require a key file to log into the server before you are able to run commands; this depends on your SSH server.
Use the following information to configure the Run SSH Command activity.
Details
Settings | Configuration Instructions |
---|---|
Computer | Type the name of the computer or IP address where the SSH server is running. You can also use the ellipsis (. ) button to browse for the computer. |
Port | Type the port number that you need to use to connect to the SSH server. |
Run Command | Select this option and type the command that you want to run on the SSH server after the connection has been established. |
Command Set File | Select this option and specify a file that contains a set of commands that will be run on the SSH server when the connection has been established. The command set file must use the scripting language of the native shell on the SSH server. |
Accept Host Key Change | Select this option to accept host key changes when they occur. Security Note: It is recommended that you do not use this setting because it can cause a runbook to accept any change in a server, including any that are for malicious purposes. By selecting this option, you are instructing the activity to connect to any server, regardless of the host key. Only use this option for testing purposes. |
Connection Timeout | Specify the amount of time, in seconds, that the Run SSH Command activity will wait for the SSH command to complete. Configure a value of 0 (zero), or leave the box blank, to wait indefinitely. |
After the timeout period has elapsed, the Run SSH Command activity times out and returns a warning. The command that you ran may continue running, regardless of whether the Run SSH Command activity times out.
Advanced
Settings | Configuration Instructions |
---|---|
Username | Type the username that you need to log into the SSH server. |
Password | Select this option and type the password that is associated with the Username that you specified. |
Key File | Select this option to specify a key file to use. You must use the PuTTY key file generator to create a key file. You can download this tool from Download PuTTY — a free SSH and telnet client for Windows. |
Passphrase | Type the passphrase that is associated with the key file that you specified. |
Published Data
The following table lists the published data items.
Item | Description |
---|---|
Command | The command that ran on the SSH server. This data is not available when the Command Set File option is selected. |
Command Set file | The command set file that was used to run commands on the SSH server. This option is not available when the Run Command option is selected. |
Computer name | The name or IP address of the SSH server. |
Execution Result | The text that was published as output from the commands that were run on the SSH server. |
Exit Code | The exit code published by the command. When using a command set file, this will be the exit code of the last command in the file. |
Key file path | The path of the key file that was used to authenticate with the SSH server. |
Port | The port used to connect to the SSH server. |
Username | The username used to log into the SSH server. |
Next steps
see the article on how to get the SNMP variables.
Выполнение команды SSH Run SSH Command
Эта версия Orchestrator достигла конца поддержки, мы рекомендуем выполнить обновление до Orchestrator 2019. This version of Orchestrator has reached the end of support, we recommend you to upgrade to Orchestrator 2019.
Действие выполнить команду SSH открывает SSH-подключение к удаленному серверу и выполняет команды оболочки на этом сервере. The Run SSH Command activity opens an SSH connection to a remote server and runs shell commands on that server. Действие выполнение команды SSH используется для запуска приложений резервного копирования или пакетного сценария, выполняющего набор сложных команд на компьютере, отличном от Windows. Use the Run SSH Command activity to run backup applications or a batch script that runs a set of complex commands on a non-Windows computer. Действие выполнить команду SSH может выполнять любую команду в Secure Shell. The Run SSH Command activity can run any command in a Secure Shell.
Действие выполнения команды SSH основано на выводимой бета-версии. 70. Run SSH Command activity is based on PuTTY beta .70. Реализация SSH в «выполнении команды SSH» имеет определенные ограничения: The implementation of SSH in «Run SSH Command» has certain limitations:
Действие «выполнить команду SSH» не работает для всех серверов SSH-1 и SSH-2. The Run SSH Command activity does not work against all SSH-1 and SSH-2 servers. Как правило, это действие работает с большинством серверов SSH, но не работает для всех реализаций сервера SSH. In general, this activity functions with most SSH servers, but it does not work for all SSH server implementations.
Чтобы создать ключи для действия «выполнение команды SSH», необходимо загрузить и использовать средство формирования ключей. You must download and use the PuTTy key generation tool to create keys for the Run SSH Command activity. Средство создания ключей доступно в файле с выводимыми сведениями о бесплатном клиенте SSH и Telnet для Windows. The key generation tool is available at Download PuTTY — a free SSH and telnet client for Windows.
Действие «выполнить команду SSH» поддерживает SSH-1. The Run SSH Command activity supports SSH-1. Корпорация Майкрософт не рекомендует использовать SSH-1. Microsoft does not recommend the use of SSH-1. Если вы хотите запретить действию команды Run SSH использовать SSH-1, следует использовать файл ключа, содержащий ключи, которые не поддерживают SSH-1. If you want to prevent The Run SSH Command activity from using SSH-1, you should use a key file that contains keys that do not support SSH-1. Не используйте для имени пользователя и пары паролей файл ключа. Do not use a username and password pair use a key file.
Изменение ключа узла для принятия свойства не рекомендуется. The property Accept Host Key Change is not a recommended setting. Это свойство должно использоваться только для установления первоначального подключения к компьютеру, когда ключ хранится на сервере Runbook. This property should only be used to establish the initial connection to a computer when the key is stored on the runbook server. Для модулей Runbook, содержащих действие «выполнить команду SSH», необходимо отключить параметр » принять изменение ключа узла «. Runbooks that contain the Run SSH Command activity should be configured with Accept Host Key Change disabled. При использовании этого свойства отключает проверку подлинности сервера SSH и представляет угрозу безопасности. When you use this property it disables the validation of the identity of the SSH server and represents a security risk.
Просмотрите список, если криптографические шифры поддерживаются выводимым методом, который находится в [ https://the.earth.li/
sgtatham/putty/0.70/htmldoc/Chapter4.html#config-ssh-encryption ). You should review the list if cryptographic ciphers supported by PuTTY, which is found at [https://the.earth.li/
Выводимая бета-версия. 61 использует генератор псевдослучайное Number, подходящий для большинства криптографических целей. PuTTY beta .61 uses a pseudorandom number generator suitable for most cryptographic purposes. Не рекомендуется использовать для создания долгосрочных криптографических ключей. It is not recommended for the generation of long-term cryptographic keys.
Дополнительные сведения о выводимых файлах см. в статье Загрузка выводимых данных — бесплатный клиент SSH и Telnet для Windows. For more information about PuTTY, go to Download PuTTY — a free SSH and telnet client for Windows.
Настройка действия «Запуск команды SSH» Configuring the Run SSH Command Activity
Перед настройкой действия «Запуск команды SSH» необходимо определить следующее: Before you configure the Run SSH Command activity, you need to determine the following:
Сведения о соединении для компьютера, на котором размещен сервер SSH, к которому необходимо подключиться. Connection information for the computer that hosts the SSH server that you want to connect to.
Команды, которые необходимо выполнить. Commands that you want to run.
Требуется ли файл ключа для входа на сервер, прежде чем можно будет выполнять команды; Это зависит от сервера SSH. Whether you require a key file to log into the server before you are able to run commands; this depends on your SSH server.
Используйте следующие сведения для настройки действия «выполнение команды SSH». Use the following information to configure the Run SSH Command activity.
Сведения Details
Параметры Settings | Инструкции по настройке Configuration Instructions |
---|---|
Компьютер Computer | Введите имя компьютера или IP-адреса, на котором работает сервер SSH. Type the name of the computer or IP address where the SSH server is running. Для поиска компьютера можно также использовать кнопку с многоточием (. ) . You can also use the ellipsis (. ) button to browse for the computer. |
порт. Port | Введите номер порта, который необходимо использовать для подключения к серверу SSH. Type the port number that you need to use to connect to the SSH server. |
Запуск команды Run Command | Выберите этот параметр и введите команду, которую требуется запустить на сервере SSH после установки соединения. Select this option and type the command that you want to run on the SSH server after the connection has been established. |
Файл набора команд Command Set File | Выберите этот параметр и укажите файл, содержащий набор команд, которые будут выполняться на сервере SSH при установке соединения. Select this option and specify a file that contains a set of commands that will be run on the SSH server when the connection has been established. Файл набора команд должен использовать язык скриптов собственной оболочки на сервере SSH. The command set file must use the scripting language of the native shell on the SSH server. |
Принять изменение ключа узла Accept Host Key Change | Выберите этот параметр, чтобы принять изменения ключа узла при их возникновении. Select this option to accept host key changes when they occur. Примечание по безопасности. Не рекомендуется использовать этот параметр, так как он может привести к тому, что модуль Runbook будет принимать любые изменения на сервере, включая все, что необходимо для вредоносных целей. Security Note: It is recommended that you do not use this setting because it can cause a runbook to accept any change in a server, including any that are for malicious purposes. При выборе этого параметра вы указываете действию подключиться к любому серверу независимо от ключа узла. By selecting this option, you are instructing the activity to connect to any server, regardless of the host key. Используйте этот параметр только для целей тестирования. Only use this option for testing purposes. |
Время ожидания соединения Connection Timeout | Укажите время в секундах, в течение которого действие команды «выполнить SSH» будет ожидать завершения команды SSH. Specify the amount of time, in seconds, that the Run SSH Command activity will wait for the SSH command to complete. Задайте значение 0 (ноль) или оставьте поле пустым, чтобы время ожидания не ограничено. Configure a value of 0 (zero), or leave the box blank, to wait indefinitely. |
По истечении времени ожидания действие команды Run SSH истекает из состояния ожидания и возвращает предупреждение. After the timeout period has elapsed, the Run SSH Command activity times out and returns a warning. Выполняемая команда может продолжать работать независимо от того, истечет ли время действия команды Run SSH. The command that you ran may continue running, regardless of whether the Run SSH Command activity times out.
Продвинутый уровень Advanced
Параметры Settings | Инструкции по настройке Configuration Instructions |
---|---|
Имя пользователя Username | Введите имя пользователя, которое необходимо войти на сервер SSH. Type the username that you need to log into the SSH server. |
Пароль Password | Выберите этот параметр и введите пароль, связанный с указанным именем пользователя. Select this option and type the password that is associated with the Username that you specified. |
Файл ключа Key File | Выберите этот параметр, чтобы указать используемый файл ключа. Select this option to specify a key file to use. Для создания файла ключа необходимо использовать генератор файлового ключа выводимых ключей. You must use the PuTTY key file generator to create a key file. Это средство можно загрузить с ознакомительного выводимого файла — бесплатного клиента SSH и Telnet для Windows. You can download this tool from Download PuTTY — a free SSH and telnet client for Windows. |
Парольная фраза Passphrase | Введите парольную фразу, связанную с указанным файлом ключа. Type the passphrase that is associated with the key file that you specified. |
Опубликованные данные Published Data
В следующей таблице перечислены опубликованные элементы данных. The following table lists the published data items.
Элемент Item | Описание Description |
---|---|
Get-Help Command | Команда, которая выполнялась на сервере SSH. The command that ran on the SSH server. Эти данные недоступны, если выбран параметр Командный набор файлов . This data is not available when the Command Set File option is selected. |
Файл набора команд Command Set file | Файл набора команд, который использовался для выполнения команд на сервере SSH. The command set file that was used to run commands on the SSH server. Этот параметр недоступен, если выбран параметр выполнить команду . This option is not available when the Run Command option is selected. |
Имя компьютера Computer name | Имя или IP-адрес сервера SSH. The name or IP address of the SSH server. |
Результат выполнения Execution Result | Текст, опубликованный в виде выходных данных команд, которые были запущены на сервере SSH. The text that was published as output from the commands that were run on the SSH server. |
Код завершения Exit Code | Код выхода, опубликованный командой. The exit code published by the command. При использовании файла набора команд это будет код выхода последней команды в файле. When using a command set file, this will be the exit code of the last command in the file. |
Путь к файлу ключа Key file path | Путь к файлу ключа, который использовался для проверки подлинности на сервере SSH. The path of the key file that was used to authenticate with the SSH server. |
Port Port | Порт, используемый для подключения к серверу SSH. The port used to connect to the SSH server. |
Имя пользователя Username | Имя пользователя, используемое для входа на сервер SSH. The username used to log into the SSH server. |
Следующие шаги Next steps
см. статью о том, как получить переменные SNMP. see the article on how to get the SNMP variables.