File system Command

File system Command

Certified

Run commands over SSH

Executes one or more commands on a remote host via SSH. Supports PASSWORD, PUBLIC_KEY, or OPEN_SSH auth. Default port 22 and strict host key checking off (no). Allow weak rsa-sha1 only when enableSshRsa1 is true.

yaml
type: io.kestra.plugin.fs.ssh.Command

Run SSH command using password authentication

yaml
id: fs_ssh_command
namespace: company.team

tasks:
  - id: command
    type: io.kestra.plugin.fs.ssh.Command
    host: localhost
    port: "22"
    authMethod: PASSWORD
    username: foo
    password: "{{ secret('SSH_PASSWORD') }}"
    commands:
      - ls

Run SSH command using public key authentication (must be an OpenSSH private key)

yaml
id: fs_ssh_command
namespace: company.team

tasks:
  - id: command
    type: io.kestra.plugin.fs.ssh.Command
    host: localhost
    port: "22"
    authMethod: PUBLIC_KEY
    username: root
    privateKey: "{{ secret('SSH_RSA_PRIVATE_KEY') }}"
    commands:
      - touch kestra_was_here

Run SSH command through a proxy command

yaml
id: fs_ssh_proxy_command
namespace: company.team

tasks:
  - id: command
    type: io.kestra.plugin.fs.ssh.Command
    host: host
    username: user
    authMethod: PASSWORD
    password: "{{ secret('SSH_PASSWORD') }}"
    proxyCommand: |
      cloudflared access ssh --service-token-id {{ secret('SSH_PROXY_SERVICE_TOKEN_ID') }} --service-token-secret {{ secret('SSH_PROXY_SERVICE_TOKEN_SECRET') }} --hostname proxy_host
    commands:
      - mycmd

Run SSH command using the local OpenSSH configuration

yaml
id: ssh
namespace: company.team
tasks:
  - id: ssh
    type: io.kestra.plugin.fs.ssh.Command
    authMethod: OPEN_SSH
    host: localhost
    password: "{{ secret('SSH_PASSWORD') }}"
    commands:
      - echo "Hello World"
Properties
SubTypestring
Min items1

Commands to execute

Remote host

DefaultPASSWORD
Possible Values
PASSWORDPUBLIC_KEYOPEN_SSH

SSH authentication configuration

When authMethod is OPEN_SSH, access to local SSH config must be allowed with allow-open-ssh-config: true in plugin defaults:

kestra: 
  plugins: 
    configurations: 
      - type: io.kestra.plugin.fs.ssh.Command
        values: 
          allow-open-ssh-config: true
Defaultfalse

Enable the disabled by default RSA/SHA1 algorithm

Environment variables to pass to the SSH process

OpenSSH config file path

Used when authMethod is OPEN_SSH. Access must be allowed via plugin configuration.

Password

Required for PASSWORD auth; optional for OPEN_SSH when config supplies credentials.

Reference (ref) of the pluginDefaults to apply to this task.

Default22

Remote port

Private SSH key

OpenSSH private key content for PUBLIC_KEY auth.

Private key passphrase

Optional passphrase for the private key.

Proxy command

Optional local command used to establish the SSH transport (OpenSSH ProxyCommand semantics). Example: cloudflared access ssh --service-token-id ... --service-token-secret ... --hostname ...

Defaultno

Strict host key checking

One of yes|no|ask. Default no.

Username

Required for PASSWORD and PUBLIC_KEY methods.

Default0

The exit code of the entire flow execution

The values extracted from executed commands using the Kestra outputs format