企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# C.90 SshTask The `SshTask` executes commands on a remote host using ssh. This task requires the [PHP SSH2 extension](http://pecl.php.net/package/ssh2) to function. Table C.122:聽Attributes NameTypeDescriptionDefaultRequired`host``String`Remote hostnoneYes`port``Integer`Remote port22No`username``String`Username to use for the connectionnoneYes`password``String`Password to use for the connectionnoneNo`pubkeyfile``String`Public key file (OpenSSH format) to use for the connectionnoneNo`privkeyfile``String`Private key file (OpenSSH format) to use for the connectionnoneNo`privkeyfilepassphrase``String`Private key file passphrase to use for the connectionnoneNo`command``String`Command to execute on the remote servernoneYes`property``String`The name of the property to capture (any) output of the commandnoneNo`display``Boolean`Whether to display the output of the command`true`No`pty``String`The terminal type to open`none`No`failonerror``Boolean`Decides if a command chain will fail if one of the executed commands failed. Added for backward compatibility. Set to true if you execute more than one command and want the task to fail on any error.`False`No C.90.1 Example ``` <ssh username="john" password="smith" host="webserver" command="ls" /> ``` Executes a single command on the remote server. C.90.2 Supported Nested Tags - `sshconfig` Sometimes it is necessary to set specific configuration parameters on the ssh connection when connecting to a remote server. You can set them with the sshconfig nested tag. Set the parameters to specify connection and encryption options. These are the parameters as specified by the $methods parameter of the ssh2\_connect function. See [ssh2\_connect](http://us3.php.net/ssh2_connect) for more information sshconfig can also be used as project level parameter with a refid so the same parameters can be re-used across a project easily. Table C.123:聽Attributes NameTypeDescriptionDefaultRequired`kex``String`List of key exchange methods to advertise, comma separated in order of preference.n/aNo`hostkey``String`List of hostkey methods to advertise, come separated in order of preference.n/aNo`client``Nested Tag`Element containing attributes crypt, comp, and mac method preferences for messages sent from client to server. All attributes are optional.n/aNo`server``Nested Tag`Element containing attributes crypt, comp, and mac method preferences for messages sent from server to client. All attributes are optional.n/aNo