Options

–1
Specifies the use of SSH protocol version 1. Because SSH protocol version 1 does not support subsystems, you must specify –s with an sftp-server path when using this option. This option is only supported if both the local and remote hosts are z/OS® systems.
–2
Forces SSH to try protocol version 2 only. If both –1 and –2 are specified, sftp uses the option that appears last on the command line.
–4
Forces SSH to use IPv4 addresses only. If both –4 and –6 are specified, sftp uses the option that appears last on the command line.
–6
Forces SSH to use IPv6 addresses only. If both –4 and –6 are specified, sftp uses the option that appears last on the command line.
–b batchfile
Batch mode reads a series of commands from an input batchfile instead of stdin. Because it lacks user interaction, use it in conjunction with noninteractive authentication. A batchfile of '-' can be used to indicate standard input. sftp ends and the exit value is set to nonzero only if any of the following commands fail: get, put, reget,rename, ln, rm, rmdir, mkdir, cd, ls, lcd, chmod, chown, chgrp, lpwd, df, symlik and lmkdir. For an exception, see Limitations. This option causes sftp to pass -oBatchMode=yes to ssh.

Ending on error can be suppressed on a command-by-command basis by prefixing the command with a '-' character.

For example:
-rm /tmp/file*
–B buffer_size
Specifies the size of the buffer that sftp uses when transferring files. Larger buffers require fewer round trips at the cost of higher memory consumption. The default is 32768 bytes. If specifying buffer_size > INT_MAX, sftp only allocates INT_MAX at most. For more information, see Limitations.
–c cipher
Selects the cipher to use for encrypting the data transfers. This option is directly passed to ssh.
–C
Enables compression. This option is passed to ssh.
–D sftp-server_path
Connects directly to the local sftp-server (instead of by way of ssh). This option might be used in debugging the client and server.

Restriction: When this option is specified, SMF client transfer completion records (subtype 97) are not collected.

–F ssh_config
Specifies an alternative per-user ssh_config configuration file for ssh. This option is directly passed to ssh. It has no effect on the z/OS-specific configuration files.
–i identity_file
Selects the file from which the identity (private key) for public key authentication is read. This option is directly passed to ssh. See page for more information.
–l limit
Limits the used bandwidth, specified in Kbit/s.
–o ssh_option
Can be used to pass options to ssh in the format used in the ssh_config and zos_user_ssh_config configuration files. This is useful for specifying options for which there is no separate sftp command-line flag. For full details of the available options and their values, see ssh_config and zos_user_ssh_config. The z/OS-specific per-user OpenSSH client configuration options can be specified on -o, but the z/OS-specific system-wide options (see zos_ssh_config) cannot.
Example: To specify an alternate port, use:
sftp -oPort=24
sftp always passes the following options to ssh:
  • ForwardX11=no
  • ForwardAgent=no
  • PermitLocalCommand=no
  • ClearAllForwardings=yes
–p
Preserves modification times, access times, and modes from the original files transferred.
–P port
Specifies the port to connect to on the remote host.
–q
Quiet mode: disables the progress meter as well as warning and diagnostic messages from ssh.
–r
Recursively copy entire directories when uploading and downloading.
Note: sftp does not follow symbolic links found in tree traversal.
–R num_requests
Specifies the number of requests that can be outstanding at any one time. Increasing this might slightly improve file transfer speed, but increases memory usage. The default is 16 outstanding requests.
–s subsystem | sftp_server
Specifies the SSH protocol version 2 subsystem or the path for an sftp server on the remote host. An sftp-server path is useful for using sftp over SSH protocol version 1 or when the remote sshd does not have an sftp subsystem configured.
–S program
Name of the program to use for the encrypted connection. The program must understand ssh options. On z/OS, if this option is specified, then sftp will hang unless the program provides SMF information.
–v
Enables verbose mode. This option is also passed to ssh. Multiple –v options increase the verbosity. You can specify up to three -v options.