salt.modules.scp

SCP Module

New in version 2019.2.0.

Module to copy files via SCP

salt.modules.scp_mod.get(remote_path, local_path='', recursive=False, preserve_times=False, **kwargs)

Transfer files and directories from remote host to the localhost of the Minion.

remote_path

Path to retrieve from remote host. Since this is evaluated by scp on the remote host, shell wildcards and environment variables may be used.

recursive: False

Transfer files and directories recursively.

preserve_times: False

Preserve mtime and atime of transferred files and directories.

hostname

The hostname of the remote device.

port: 22

The port of the remote device.

username

The username required for SSH authentication on the device.

password

Used for password authentication. It is also used for private key decryption if passphrase is not given.

passphrase

Used for decrypting private keys.

pkey

An optional private key to use for authentication.

key_filename

The filename, or list of filenames, of optional private key(s) and/or certificates to try for authentication.

timeout

An optional timeout (in seconds) for the TCP connect.

socket_timeout: 10

The channel socket timeout in seconds.

buff_size: 16384

The size of the SCP send buffer.

allow_agent: True

Set to False to disable connecting to the SSH agent.

look_for_keys: True

Set to False to disable searching for discoverable private key files in ~/.ssh/

banner_timeout

An optional timeout (in seconds) to wait for the SSH banner to be presented.

auth_timeout

An optional timeout (in seconds) to wait for an authentication response.

auto_add_policy: False

Automatically add the host to the known_hosts.

CLI Example:

salt '*' scp.get /var/tmp/file /tmp/file hostname=10.10.10.1 auto_add_policy=True

salt.modules.scp_mod.put(files, remote_path=None, recursive=False, preserve_times=False, saltenv='base', **kwargs)

Transfer files and directories to remote host.

files

A single path or a list of paths to be transferred.

remote_path

The path on the remote device where to store the files.

recursive: True

Transfer files and directories recursively.

preserve_times: False

Preserve mtime and atime of transferred files and directories.

hostname

The hostname of the remote device.

port: 22

The port of the remote device.

username

The username required for SSH authentication on the device.

password

Used for password authentication. It is also used for private key decryption if passphrase is not given.

passphrase

Used for decrypting private keys.

pkey

An optional private key to use for authentication.

key_filename

The filename, or list of filenames, of optional private key(s) and/or certificates to try for authentication.

timeout

An optional timeout (in seconds) for the TCP connect.

socket_timeout: 10

The channel socket timeout in seconds.

buff_size: 16384

The size of the SCP send buffer.

allow_agent: True

Set to False to disable connecting to the SSH agent.

look_for_keys: True

Set to False to disable searching for discoverable private key files in ~/.ssh/

banner_timeout

An optional timeout (in seconds) to wait for the SSH banner to be presented.

auth_timeout

An optional timeout (in seconds) to wait for an authentication response.

auto_add_policy: False

Automatically add the host to the known_hosts.

CLI Example:

salt '*' scp.put /path/to/file /var/tmp/file hostname=server1 auto_add_policy=True

© 2021 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltproject.io/en/latest/ref/modules/all/salt.modules.scp_mod.html