SFTP(1) | General Commands Manual | SFTP(1) |
sftp
— secure file
transfer program
sftp |
[-46aCfpqrv ] [-B
buffer_size] [-b
batchfile] [-c
cipher] [-D
sftp_server_path] [-F
ssh_config] [-i
identity_file] [-l
limit] [-o
ssh_option] [-P
port] [-R
num_requests] [-S
program] [-s
subsystem | sftp_server]
destination |
sftp
is a file transfer program, similar
to ftp(1), which performs all operations over an encrypted
ssh(1) transport. It may also use many features of ssh,
such as public key authentication and compression.
The destination may be specified either as [user@]host[:path] or as a URI in the form sftp://[user@]host[:port][/path].
If the destination includes a
path and it is not a directory,
sftp
will retrieve files automatically if a
non-interactive authentication method is used; otherwise it will do so after
successful interactive authentication.
If no path is specified, or if the
path is a directory, sftp
will
log in to the specified host and enter interactive
command mode, changing to the remote directory if one was specified. An
optional trailing slash can be used to force the path
to be interpreted as a directory.
Since the destination formats use colon characters to delimit host names from path names or port numbers, IPv6 addresses must be enclosed in square brackets to avoid ambiguity.
The options are as follows:
-4
sftp
to use IPv4 addresses only.-6
sftp
to use IPv6 addresses only.-a
-B
buffer_sizesftp
uses when
transferring files. Larger buffers require fewer round trips at the cost
of higher memory consumption. The default is 32768 bytes.-b
batchfilesftp
will abort if any of
the following commands fail: get
,
put
, reget
,
reput, rename
, ln
,
rm
, mkdir
,
chdir
, ls
,
lchdir
, chmod
,
chown
, chgrp
,
lpwd
, df
,
symlink
, and lmkdir
.
Termination on error can be suppressed on a command by command basis by
prefixing the command with a ‘-’ character (for example,
-rm /tmp/blah*
).-C
-C
flag).-c
cipher-D
sftp_server_path-F
ssh_config-f
-i
identity_file-l
limit-o
ssh_optionssh
in the format
used in ssh_config(5). This is useful for specifying
options for which there is no separate sftp
command-line flag. For example, to specify an alternate port use:
sftp -oPort=24
. For full details of the options
listed below, and their possible values, see
ssh_config(5).
-P
port-p
-q
-R
num_requests-r
sftp
does not follow symbolic links
encountered in the tree traversal.-S
program-s
subsystem | sftp_server-v
Once in interactive mode, sftp
understands
a set of commands similar to those of ftp(1). Commands are
case insensitive. Pathnames that contain spaces must be enclosed in quotes.
Any special characters contained within pathnames that are recognized by
glob(3) must be escaped with backslashes
(‘\’).
bye
sftp
.cd
[path]chgrp
grp pathchmod
mode pathchown
own pathdf
[-hi
] [path]-h
flag is specified, the capacity information
will be 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
sftp
.get
[-afPpr
] remote-path
[local-path]If the -a
flag is specified, then
attempt to resume partial transfers of existing files. Note that
resumption assumes that any partial copy of the local file matches the
remote copy. If the remote file contents differ from the partial local
copy then the resultant file is likely to be corrupt.
If the -f
flag is specified, then
fsync(2) will be called after the file transfer has
completed to flush the file to disk.
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
lcd
[path]lls
[ls-options [path]]lmkdir
pathln
[-s
] oldpath
newpath-s
flag is
specified the created link is a symbolic link, otherwise it is a hard
link.lpwd
ls
[-1afhlnrSt
] [path]The following flags are recognized and alter the behaviour of
ls
accordingly:
-1
-a
-f
-h
-l
-n
-r
-S
-t
lumask
umaskmkdir
pathprogress
put
[-afPpr
] local-path
[remote-path]If the -a
flag is specified, then
attempt to resume partial transfers of existing files. Note that
resumption assumes that any partial copy of the remote file matches the
local copy. If the local file contents differ from the remote local copy
then the resultant file is likely to be corrupt.
If the -f
flag is specified, then a
request will be sent to the server to call fsync(2)
after the file has been transferred. Note that this is only supported by
servers that implement the "fsync@openssh.com" extension.
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.
pwd
quit
sftp
.reget
[-Ppr
] remote-path
[local-path]get
with the -a
flag
set.reput
[-Ppr
] [local-path]
remote-pathput
with the -a
flag
set.rename
oldpath newpathrm
pathrmdir
pathsymlink
oldpath newpathversion
sftp
protocol version.!
command!
?
ftp(1), ls(1), scp(1), ssh(1), ssh-add(1), ssh-keygen(1), ssh_config(5), glob(7), sftp-server(8), sshd(8)
T. Ylonen and S. Lehtinen, SSH File Transfer Protocol, draft-ietf-secsh-filexfer-00.txt, January 2001, work in progress material.
September 20, 2018 | Debian |