SFTP(1) | General Commands Manual | SFTP(1) |
sftp
— OpenSSH
secure file transfer
sftp |
[-46AaCfNpqrv ] [-B
buffer_size] [-b
batchfile] [-c
cipher] [-D
sftp_server_path] [-F
ssh_config] [-i
identity_file] [-J
destination] [-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
-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
batchfileA batchfile of ‘-’ may be
used to indicate standard input. sftp
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*
). Echo of the command
may be suppressed by prefixing the command with a ‘@’
character. These two prefixes may be combined in any order, for example
-@ls /bsd
.
-C
-C
flag).-c
cipher-D
sftp_server_path-F
ssh_config-f
-i
identity_file-J
destinationsftp
connection to the jump host described by destination
and then establishing a TCP forwarding to the ultimate destination from
there. Multiple jump hops may be specified separated by comma characters.
This is a shortcut to specify a ProxyJump
configuration directive. This option is directly passed to
ssh(1).-l
limit-N
-b
flag.-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
[-h
] grp
path-h
flag is
specified, then symlinks will not be followed. path
may contain glob(7) characters and may match multiple
files. grp must be a numeric GID.chmod
[-h
] mode
path-h
flag is
specified, then symlinks will not be followed. path
may contain glob(7) characters and may match multiple
files.chown
[-h
] own
path-h
flag is
specified, then symlinks will not be followed. path
may contain glob(7) characters and may match multiple
files. own must be a numeric UID.df
[-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
[-afpR
] 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 the -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
[-afpR
] 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 the -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
[-fpR
] remote-path
[local-path]get
with the -a
flag
set.reput
[-fpR
] local-path
[remote-path]put
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.
August 3, 2020 | Debian |