sftp [options] host

An interactive file transfer program, similar to ftp except that it uses ssh to perform file transfers securely. sftp connects to host and logs in, prompting for a password if required. The host can be specified in the following ways:

[user@]host[:file [file] ...]

If user is specified, that username is used for the login. If any files are specified, the sftp client automatically retrieves them after the user has been authenticated, and then exits. If a directory dir is specified, the client starts in that directory on the remote host. sftp is part of the OpenSSH suite of network tools.



Use SSH1. The default is to use SSH2, which offers stronger security.

-b file

Run in batch mode, taking commands from the specified file. Requires the use of a noninteractive authentication mechanism.

-B bytes

Specify the size of the buffer sftp uses for file transfers. Default is 32768 bytes.


Enable compression (uses ssh -C).

-F file

Use file as the ssh configuration file instead of the default system configuration file. The systemwide file is usually /etc/ssh/ssh_config, and per-user files are $HOME/.ssh/config.

-o option

Pass an option to ssh. The passed option is in the format used by ssh_config(5) (e.g., -o PORT=nn, where nn is the port number). -o can appear more than once to pass multiple options to ssh. This option is useful for passing options that don’t have an equivalent sftp command-line option.

-P server_path

Connect directly ...

Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.