SSH@0 - SSH v0 task
Use this task to run shell commands or a script on a remote machine using SSH. This task enables you to connect to a remote machine using SSH and run commands or a script.
Syntax
# SSH v0
# Run shell commands or a script on a remote machine using SSH.
- task: SSH@0
inputs:
sshEndpoint: # string. Required. SSH service connection.
runOptions: 'commands' # 'commands' | 'script' | 'inline'. Required. Run. Default: commands.
commands: # string. Required when runOptions = commands. Commands.
#scriptPath: # string. Required when runOptions = script. Shell script path.
#inline: # string. Required when runOptions = inline. Inline Script.
#interpreterCommand: '/bin/bash' # string. Optional. Use when runOptions = inline. Interpreter command. Default: /bin/bash.
#args: # string. Optional. Use when runOptions = script. Arguments.
# Advanced
#failOnStdErr: true # boolean. Fail on STDERR. Default: true.
#interactiveSession: false # boolean. Enable interactive session. Default: false.
readyTimeout: '20000' # string. Required. SSH handshake timeout. Default: 20000.
#interactiveKeyboardAuthentication: false # boolean. Use interactive-keyboard authentication. Default: false.
# SSH v0
# Run shell commands or a script on a remote machine using SSH.
- task: SSH@0
inputs:
sshEndpoint: # string. Required. SSH service connection.
runOptions: 'commands' # 'commands' | 'script' | 'inline'. Required. Run. Default: commands.
commands: # string. Required when runOptions = commands. Commands.
#scriptPath: # string. Required when runOptions = script. Shell script path.
#inline: # string. Required when runOptions = inline. Inline Script.
#interpreterCommand: '/bin/bash' # string. Optional. Use when runOptions = inline. Interpreter command. Default: /bin/bash.
#args: # string. Optional. Use when runOptions = script. Arguments.
# Advanced
#failOnStdErr: true # boolean. Fail on STDERR. Default: true.
#interactiveSession: false # boolean. Enable interactive session. Default: false.
readyTimeout: '20000' # string. Required. SSH handshake timeout. Default: 20000.
# SSH v0
# Run shell commands or a script on a remote machine using SSH.
- task: SSH@0
inputs:
sshEndpoint: # string. Required. SSH service connection.
runOptions: 'commands' # 'commands' | 'script' | 'inline'. Required. Run. Default: commands.
commands: # string. Required when runOptions = commands. Commands.
#scriptPath: # string. Required when runOptions = script. Shell script path.
#inline: # string. Required when runOptions = inline. Inline Script.
#args: # string. Optional. Use when runOptions = script. Arguments.
# Advanced
#failOnStdErr: true # boolean. Fail on STDERR. Default: true.
readyTimeout: '20000' # string. Required. SSH handshake timeout. Default: 20000.
# SSH v0
# Run shell commands or a script on a remote machine using SSH.
- task: SSH@0
inputs:
sshEndpoint: # string. Required. SSH service connection.
runOptions: 'commands' # 'commands' | 'script' | 'inline'. Required. Run. Default: commands.
commands: # string. Required when runOptions = commands. Commands.
#scriptPath: # string. Required when runOptions = script. Shell script path.
#inline: # string. Required when runOptions = inline. Inline Script.
#args: # string. Optional. Use when runOptions = script. Arguments.
# Advanced
#failOnStdErr: true # boolean. Fail on STDERR. Default: true.
Inputs
sshEndpoint
- SSH service connection
string
. Required.
Specifies the name of an SSH service connection containing connection details for the remote machine. The hostname or IP address of the remote machine, the port number, and the user name are required to create an SSH service connection.
- The private key and the passphrase must be specified for authentication.
- A password can be used to authenticate to remote Linux machines, but this is not supported for macOS or Windows systems.
runOptions
- Run
string
. Required. Allowed values: commands
, script
(Script File), inline
(Inline Script). Default value: commands
.
Runs shell commands or a shell script on the remote machine.
commands
- Commands
string
. Required when runOptions = commands
.
Specifies the shell commands to run on the remote machine. This parameter is available only when Commands is selected for the Run option. Enter each command together with its arguments on a new line of the multi-line textbox. To run multiple commands together, enter them on the same line separated by semicolons. Example: cd /home/user/myFolder;build
.
Note
Each command runs in a separate process. If you want to run a series of commands that are interdependent (for example, changing the current folder before executing a command), use the Inline Script option instead.
scriptPath
- Shell script path
string
. Required when runOptions = script
.
Specifies the path to the shell script file to run on the remote machine. This parameter is available only when Shell script is selected for the Run option.
inline
- Inline Script
string
. Required when runOptions = inline
.
Writes the shell script to run on the remote machine.
interpreterCommand
- Interpreter command
string
. Optional. Use when runOptions = inline
. Default value: /bin/bash
.
Specifies the path to the command interpreter used to execute the script. Adds a shebang line to the beginning of the script. Relevant only for UNIX-like operating systems. Use an empty string for Windows-based remote hosts. Learn more about shebang (#!).
args
- Arguments
string
. Optional. Use when runOptions = script
.
Specifies the arguments to pass to the shell script. This parameter is available only when Shell script is selected for the Run option.
failOnStdErr
- Fail on STDERR
boolean
. Default value: true
.
If the value is true
, the build fails when the remote commands or script write to STDERR
.
interactiveSession
- Enable interactive session
boolean
. Default value: false
.
Starts an interactive session. Password requests are filled by the user's password. Interactive sessions can be useful for running commands, such as sudo
.
readyTimeout
- SSH handshake timeout
string
. Required. Default value: 20000
.
Specifies how long (in milliseconds) the task waits for the SSH handshake to complete.
interactiveKeyboardAuthentication
- Use interactive-keyboard authentication
boolean
. Default value: false
.
Enables interactive-keyboard authentication. Set to true
if your destination SSH server requires Interactive Keyboard Authentication (PasswordAuthentication
is disabled on the target machine/set to No in sshd_config).
Task control options
All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.
Output variables
None.
Remarks
Use this task to run shell commands or a script on a remote machine using SSH. This task enables you to connect to a remote machine using SSH and run commands or a script.
Prerequisites
- The task supports use of an SSH key pair to connect to the remote machine(s).
- The public key must be pre-installed or copied to the remote machine(s).
Supported algorithms
Key pair algorithms
- RSA
- DSA
Encryption algorithms
- aes256-cbc
- aes192-cbc
- aes128-cbc
- blowfish-cbc
- 3des-cbc
- arcfour256
- arcfour128
- cast128-cbc
- arcfour
For OpenSSL v1.0.1 and higher (on agent):
- aes256-ctr
- aes192-ctr
- aes128-ctr
For OpenSSL v1.0.1 and higher, NodeJS v0.11.12 and higher (on agent):
- aes128-gcm
- aes128-gcm@openssh.com
- aes256-gcm
- aes256-gcm@openssh.com
Requirements
Requirement | Description |
---|---|
Pipeline types | YAML, Classic build, Classic release |
Runs on | Agent, DeploymentGroup |
Demands | None |
Capabilities | This task does not satisfy any demands for subsequent tasks in the job. |
Command restrictions | Any |
Settable variables | Any |
Agent version | 2.206.1 or greater |
Task category | Deploy |
Requirement | Description |
---|---|
Pipeline types | YAML, Classic build, Classic release |
Runs on | Agent, DeploymentGroup |
Demands | None |
Capabilities | This task does not satisfy any demands for subsequent tasks in the job. |
Command restrictions | Any |
Settable variables | Any |
Agent version | 2.144.0 or greater |
Task category | Deploy |
Requirement | Description |
---|---|
Pipeline types | YAML, Classic build, Classic release |
Runs on | Agent, DeploymentGroup |
Demands | None |
Capabilities | This task does not satisfy any demands for subsequent tasks in the job. |
Command restrictions | Any |
Settable variables | Any |
Agent version | 2.102.0 or greater |
Task category | Deploy |