SYNOPSIS
sftp
[
sftp [[user@]host[:file [file]]]
sftp [[user@]host[:dir[/]]]
DESCRIPTION
sftp is an interactive file transfer program, similar to ftp, which performs all operations over an encrypted secsh transport. It may also use many features of secsh, such as public key authentication and compression. sftp connects and logs into the specified host, then enters an interactive command mode.
The second usage format will retrieve files automatically if a non-interactive authentication is used; otherwise, it will do so after successful interactive authentication.
The third usage format allows the sftp client to start in a remote directory.
The final usage format allows for automated sessions using the
Since some usage formats use colon characters to delimit host names from path names, IPv6 addresses must be enclosed in square brackets to avoid ambiguity.
Options
-1 -
Specifies the use of protocol version 1.
-2 -
Specifies the use of protocol version 2.
-4 -
Forces sftp to use IPv4 addresses only.
-6 -
Forces sftp to use IPv6 addresses only.
-B buffer_size-
Specifies the size of the buffers that sftp uses when transferring files. Larger buffers require fewer round trips at the cost of higher memory consumption. The default is 32768 bytes.
-b batchfile-
Batch mode reads a series of commands from an input batchfile instead of stdin. Since it lacks user interaction it should be used in conjunction with non-interactive authentication. sftp will abort if any of the following commands fail: get, put, rename, ln, rm, and lmkdir.
-C -
Enables compression (via secsh's
-C flag) -c cipher-
Selects the cipher to use for encrypting the data transfers. This option is directly passed to secsh.
-D sftp_server_path-
Connect directly to a local sftp server (rather than via secsh). This option may be useful in debugging the client and server.
-F ssh_config-
Specifies an alternative per-user configuration file for secsh. This option is directly passed to secsh.
-i identity_file-
Selects the file from which the identity (private key) for public key authentication is read. This option is directly passed to secsh.
-o ssh_option-
Any valid
-o option to secsh can be specified, and it is directly passed through when secsh is invoked. This is useful for specifying options for which there is no separate sftp command-line flag. For example, to specify an alternate port:sftp -oPort=24
-P port-
Specifies the port to connect to on the remote host.
-p -
Preserves modification times, access times, and modes from the original files transferred.
-q -
Quiet mode: disables the progress meter as well as warning and diagnostic messages from secsh.
-R num_requests-
Specifies how many requests may be outstanding at any one time. Increasing this may slightly improve file transfer speed but increases memory usage. The default is 64 outstanding requests.
-r -
Recursively copy entire directories when uploading and downloading. Note that sftp does not follow symbolic links encountered in the tree traversal.
-s subsystem|sftp_server-
Specifies the SSH2 subsystem or the path for an sftp server on the remote host. A path is useful for using sftp over protocol version 1, or when the remote secshd does not have an sftp subsystem configured.
-S program-
Specifies the name of the program to use for the encrypted connection. The program must understand secsh options.
-v -
Raises logging level. This option is also passed to secsh.
Interactive Commands
Once in interactive mode, sftp understands a set of commands similar to those of ftp. Commands are case insensitive and path names may be enclosed in quotes if they contain spaces.
- bye
-
Quits sftp
- cd path
-
Changes remote directory to path.
- lcd path
-
Changes local directory to path.
- chgrp grp path
-
Changes group of file path to grp. grp must be a numeric GID.
- chmod mode path
-
Changes permission of file path to mode.
- chown own path
-
Changes owner of file path to own. own must be a numeric UID.
- df [
-hi ] [path] -
Displays usage information for the file system holding the current directory (or path if specified). When the
-h flag is specified, the capacity information is displayed using "human-readable" suffixes. The-i flag requests display of inode information in addition to capacity information. This command is only supported on servers that implement the statvfs@openssh.com extension. - exit
-
Quits sftp.
- get [flags] remote-path [loacl-path]
-
Retrieves the remote-path and stores it on the local machine. If the local path name is not specified, it is given the same name it has on the remote machine.
If either the
-P or-p flag is specified, then full file permissions and access times are copied too.If the
-r flag is specified then directories will be copied recursively. Note that sftp does not follow symbolic links when performing recursive transfers. - help
-
Displays help text.
- lls [ls-options] [path]]
-
Displays local directory listing of either path or current directory if path is not specified.
- lmkdir path
-
Creates local directory specified by path.
- ln [
-s ] oldpath newpath -
Creates a link from oldpath to newpath. If the -s flag is specified the created link is a symbolic link, otherwise it is a hard link.
- lpwd
-
Displays local working directory.
- ls [flags] [path]
-
Displays remote directory listing of either path or current directory if path is not specified.
The following flags are recognized and alter the behavior of ls accordingly:
-1 -
Produces single column output.
-a -
Lists files beginning with a dot (.).
-f -
Does not sort the listing. This default sort is lexicographical.
-h -
When used with a long format option, use unit suffixes: Byte, Kilobyte, Megabyte, Gigabyte, Terabyte, Petabyte, and Exabyte in order to reduce the number of digits to four or fewer using powers of 2 for sizes (K=1024, M=1048576, etc.).
-l -
Displays additional details including permissions and ownership information.
-n -
Produces a long listing with user and group information presented numerically.
-r -
Reserves the sort order of the listing.
-S -
Sorts the listing by file size.
-t -
Sorts the listing by last modification time.
- lumask umask
-
Sets local umask to umask.
- mkdir path
-
Creates remote directory specified by path.
- put [flags] local-path [local-path]
-
Uploads local-path and stores it on the remote machine. If the remote path name is not specified, it is given the same name it has on the local machine. local-path may contain glob characters and may match multiple files. If it does and remote-path is specified, then remote-path must specify a directory. If the
-P flag is specified, then the file's full permission and access time are copied too.If either the -P or -p flag is specified, then full file permissions and access times are copied too.
If the -r flag is specified then directories will be copied recursively. Note that sftp does not follow symbolic links when performing recursive transfers. - progress
-
Toggles display of progress meter.
- pwd
-
Displays remote working directory.
- quit
-
Quits sftp.
- rename oldpath newpath
-
Renames remote file from oldpath to newpath.
- rmdir path
-
Removes remote directory specified by path.
- rm path
-
Deletes remote file specified by path.
- symlink oldpath newpath
-
Create a symbolic link from oldpath to newpath.
- version
-
Displays sftp protocol version.
- ! command
-
Executes command in local shell.
- !
-
Escapes to local shell.
- ?
-
Synonym for help.
AUTHORS
Damien Miller <djm@mindrot.org>
PORTABILITY
All UNIX systems. Windows 2000. Windows XP. Windows Server 2003. Windows Vista. Windows 7. Windows Server 2008. Windows 8. Windows Server 2012.
NOTES
There is no binary/text file transfer mode. All files are transferred in binary mode.
There is no file globbing capability. Thus, ls *.tar will not succeed, unless of course you are a sick and twisted individual who names files *.tar.
AVAILABILITY
MKS Toolkit for System Administrators
MKS Toolkit for Developers
MKS Toolkit for Interoperability
MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Commands:
- scp, secsh, secsh-add, secshd, secsh-keygen, secsh-keysign, sftp-server
MKS Toolkit Connectivity Solutions Guide
T. Ylonen and S. Lehtinen, SSH File Transfer Protocol, draft-ietf-secsh- filexfer-00.txt, January 2001, work in progress material.
MKS Toolkit 9.5 Documentation Build 3.