]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sftp.0
Vendor import of OpenSSH 7.7p1.
[FreeBSD/FreeBSD.git] / sftp.0
1 SFTP(1)                     General Commands Manual                    SFTP(1)
2
3 NAME
4      sftp M-bM-^@M-^S secure file transfer program
5
6 SYNOPSIS
7      sftp [-46aCfpqrv] [-B buffer_size] [-b batchfile] [-c cipher]
8           [-D sftp_server_path] [-F ssh_config] [-i identity_file] [-l limit]
9           [-o ssh_option] [-P port] [-R num_requests] [-S program]
10           [-s subsystem | sftp_server] destination
11
12 DESCRIPTION
13      sftp is a file transfer program, similar to ftp(1), which performs all
14      operations over an encrypted ssh(1) transport.  It may also use many
15      features of ssh, such as public key authentication and compression.
16
17      The destination may be specified either as [user@]host[:path] or as a URI
18      in the form sftp://[user@]host[:port][/path].
19
20      If the destination includes a path and it is not a directory, sftp will
21      retrieve files automatically if a non-interactive authentication method
22      is used; otherwise it will do so after successful interactive
23      authentication.
24
25      If no path is specified, or if the path is a directory, sftp will log in
26      to the specified host and enter interactive command mode, changing to the
27      remote directory if one was specified.  An optional trailing slash can be
28      used to force the path to be interpreted as a directory.
29
30      Since the destination formats use colon characters to delimit host names
31      from path names or port numbers, IPv6 addresses must be enclosed in
32      square brackets to avoid ambiguity.
33
34      The options are as follows:
35
36      -4      Forces sftp to use IPv4 addresses only.
37
38      -6      Forces sftp to use IPv6 addresses only.
39
40      -a      Attempt to continue interrupted transfers rather than overwriting
41              existing partial or complete copies of files.  If the partial
42              contents differ from those being transferred, then the resultant
43              file is likely to be corrupt.
44
45      -B buffer_size
46              Specify the size of the buffer that sftp uses when transferring
47              files.  Larger buffers require fewer round trips at the cost of
48              higher memory consumption.  The default is 32768 bytes.
49
50      -b batchfile
51              Batch mode reads a series of commands from an input batchfile
52              instead of stdin.  Since it lacks user interaction it should be
53              used in conjunction with non-interactive authentication to
54              obviate the need to enter a password at connection time (see
55              sshd(8) and ssh-keygen(1) for details).  A batchfile of M-bM-^@M-^X-M-bM-^@M-^Y may
56              be used to indicate standard input.  sftp will abort if any of
57              the following commands fail: get, put, reget, reput, rename, ln,
58              rm, mkdir, chdir, ls, lchdir, chmod, chown, chgrp, lpwd, df,
59              symlink, and lmkdir.  Termination on error can be suppressed on a
60              command by command basis by prefixing the command with a M-bM-^@M-^X-M-bM-^@M-^Y
61              character (for example, -rm /tmp/blah*).
62
63      -C      Enables compression (via ssh's -C flag).
64
65      -c cipher
66              Selects the cipher to use for encrypting the data transfers.
67              This option is directly passed to ssh(1).
68
69      -D sftp_server_path
70              Connect directly to a local sftp server (rather than via ssh(1)).
71              This option may be useful in debugging the client and server.
72
73      -F ssh_config
74              Specifies an alternative per-user configuration file for ssh(1).
75              This option is directly passed to ssh(1).
76
77      -f      Requests that files be flushed to disk immediately after
78              transfer.  When uploading files, this feature is only enabled if
79              the server implements the "fsync@openssh.com" extension.
80
81      -i identity_file
82              Selects the file from which the identity (private key) for public
83              key authentication is read.  This option is directly passed to
84              ssh(1).
85
86      -l limit
87              Limits the used bandwidth, specified in Kbit/s.
88
89      -o ssh_option
90              Can be used to pass options to ssh in the format used in
91              ssh_config(5).  This is useful for specifying options for which
92              there is no separate sftp command-line flag.  For example, to
93              specify an alternate port use: sftp -oPort=24.  For full details
94              of the options listed below, and their possible values, see
95              ssh_config(5).
96
97                    AddressFamily
98                    BatchMode
99                    BindAddress
100                    BindInterface
101                    CanonicalDomains
102                    CanonicalizeFallbackLocal
103                    CanonicalizeHostname
104                    CanonicalizeMaxDots
105                    CanonicalizePermittedCNAMEs
106                    CertificateFile
107                    ChallengeResponseAuthentication
108                    CheckHostIP
109                    Ciphers
110                    Compression
111                    ConnectionAttempts
112                    ConnectTimeout
113                    ControlMaster
114                    ControlPath
115                    ControlPersist
116                    GlobalKnownHostsFile
117                    GSSAPIAuthentication
118                    GSSAPIDelegateCredentials
119                    HashKnownHosts
120                    Host
121                    HostbasedAuthentication
122                    HostbasedKeyTypes
123                    HostKeyAlgorithms
124                    HostKeyAlias
125                    HostName
126                    IdentitiesOnly
127                    IdentityAgent
128                    IdentityFile
129                    IPQoS
130                    KbdInteractiveAuthentication
131                    KbdInteractiveDevices
132                    KexAlgorithms
133                    LogLevel
134                    MACs
135                    NoHostAuthenticationForLocalhost
136                    NumberOfPasswordPrompts
137                    PasswordAuthentication
138                    PKCS11Provider
139                    Port
140                    PreferredAuthentications
141                    ProxyCommand
142                    ProxyJump
143                    PubkeyAcceptedKeyTypes
144                    PubkeyAuthentication
145                    RekeyLimit
146                    SendEnv
147                    ServerAliveInterval
148                    ServerAliveCountMax
149                    StrictHostKeyChecking
150                    TCPKeepAlive
151                    UpdateHostKeys
152                    UsePrivilegedPort
153                    User
154                    UserKnownHostsFile
155                    VerifyHostKeyDNS
156
157      -P port
158              Specifies the port to connect to on the remote host.
159
160      -p      Preserves modification times, access times, and modes from the
161              original files transferred.
162
163      -q      Quiet mode: disables the progress meter as well as warning and
164              diagnostic messages from ssh(1).
165
166      -R num_requests
167              Specify how many requests may be outstanding at any one time.
168              Increasing this may slightly improve file transfer speed but will
169              increase memory usage.  The default is 64 outstanding requests.
170
171      -r      Recursively copy entire directories when uploading and
172              downloading.  Note that sftp does not follow symbolic links
173              encountered in the tree traversal.
174
175      -S program
176              Name of the program to use for the encrypted connection.  The
177              program must understand ssh(1) options.
178
179      -s subsystem | sftp_server
180              Specifies the SSH2 subsystem or the path for an sftp server on
181              the remote host.  A path is useful when the remote sshd(8) does
182              not have an sftp subsystem configured.
183
184      -v      Raise logging level.  This option is also passed to ssh.
185
186 INTERACTIVE COMMANDS
187      Once in interactive mode, sftp understands a set of commands similar to
188      those of ftp(1).  Commands are case insensitive.  Pathnames that contain
189      spaces must be enclosed in quotes.  Any special characters contained
190      within pathnames that are recognized by glob(3) must be escaped with
191      backslashes (M-bM-^@M-^X\M-bM-^@M-^Y).
192
193      bye     Quit sftp.
194
195      cd [path]
196              Change remote directory to path.  If path is not specified, then
197              change directory to the one the session started in.
198
199      chgrp grp path
200              Change group of file path to grp.  path may contain glob(3)
201              characters and may match multiple files.  grp must be a numeric
202              GID.
203
204      chmod mode path
205              Change permissions of file path to mode.  path may contain
206              glob(3) characters and may match multiple files.
207
208      chown own path
209              Change owner of file path to own.  path may contain glob(3)
210              characters and may match multiple files.  own must be a numeric
211              UID.
212
213      df [-hi] [path]
214              Display usage information for the filesystem holding the current
215              directory (or path if specified).  If the -h flag is specified,
216              the capacity information will be displayed using "human-readable"
217              suffixes.  The -i flag requests display of inode information in
218              addition to capacity information.  This command is only supported
219              on servers that implement the M-bM-^@M-^\statvfs@openssh.comM-bM-^@M-^] extension.
220
221      exit    Quit sftp.
222
223      get [-afPpr] remote-path [local-path]
224              Retrieve the remote-path and store it on the local machine.  If
225              the local path name is not specified, it is given the same name
226              it has on the remote machine.  remote-path may contain glob(3)
227              characters and may match multiple files.  If it does and
228              local-path is specified, then local-path must specify a
229              directory.
230
231              If the -a flag is specified, then attempt to resume partial
232              transfers of existing files.  Note that resumption assumes that
233              any partial copy of the local file matches the remote copy.  If
234              the remote file contents differ from the partial local copy then
235              the resultant file is likely to be corrupt.
236
237              If the -f flag is specified, then fsync(2) will be called after
238              the file transfer has completed to flush the file to disk.
239
240              If either the -P or -p flag is specified, then full file
241              permissions and access times are copied too.
242
243              If the -r flag is specified then directories will be copied
244              recursively.  Note that sftp does not follow symbolic links when
245              performing recursive transfers.
246
247      help    Display help text.
248
249      lcd [path]
250              Change local directory to path.  If path is not specified, then
251              change directory to the local user's home directory.
252
253      lls [ls-options [path]]
254              Display local directory listing of either path or current
255              directory if path is not specified.  ls-options may contain any
256              flags supported by the local system's ls(1) command.  path may
257              contain glob(3) characters and may match multiple files.
258
259      lmkdir path
260              Create local directory specified by path.
261
262      ln [-s] oldpath newpath
263              Create a link from oldpath to newpath.  If the -s flag is
264              specified the created link is a symbolic link, otherwise it is a
265              hard link.
266
267      lpwd    Print local working directory.
268
269      ls [-1afhlnrSt] [path]
270              Display a remote directory listing of either path or the current
271              directory if path is not specified.  path may contain glob(3)
272              characters and may match multiple files.
273
274              The following flags are recognized and alter the behaviour of ls
275              accordingly:
276
277              -1      Produce single columnar output.
278
279              -a      List files beginning with a dot (M-bM-^@M-^X.M-bM-^@M-^Y).
280
281              -f      Do not sort the listing.  The default sort order is
282                      lexicographical.
283
284              -h      When used with a long format option, use unit suffixes:
285                      Byte, Kilobyte, Megabyte, Gigabyte, Terabyte, Petabyte,
286                      and Exabyte in order to reduce the number of digits to
287                      four or fewer using powers of 2 for sizes (K=1024,
288                      M=1048576, etc.).
289
290              -l      Display additional details including permissions and
291                      ownership information.
292
293              -n      Produce a long listing with user and group information
294                      presented numerically.
295
296              -r      Reverse the sort order of the listing.
297
298              -S      Sort the listing by file size.
299
300              -t      Sort the listing by last modification time.
301
302      lumask umask
303              Set local umask to umask.
304
305      mkdir path
306              Create remote directory specified by path.
307
308      progress
309              Toggle display of progress meter.
310
311      put [-afPpr] local-path [remote-path]
312              Upload local-path and store it on the remote machine.  If the
313              remote path name is not specified, it is given the same name it
314              has on the local machine.  local-path may contain glob(3)
315              characters and may match multiple files.  If it does and
316              remote-path is specified, then remote-path must specify a
317              directory.
318
319              If the -a flag is specified, then attempt to resume partial
320              transfers of existing files.  Note that resumption assumes that
321              any partial copy of the remote file matches the local copy.  If
322              the local file contents differ from the remote local copy then
323              the resultant file is likely to be corrupt.
324
325              If the -f flag is specified, then a request will be sent to the
326              server to call fsync(2) after the file has been transferred.
327              Note that this is only supported by servers that implement the
328              "fsync@openssh.com" extension.
329
330              If either the -P or -p flag is specified, then full file
331              permissions and access times are copied too.
332
333              If the -r flag is specified then directories will be copied
334              recursively.  Note that sftp does not follow symbolic links when
335              performing recursive transfers.
336
337      pwd     Display remote working directory.
338
339      quit    Quit sftp.
340
341      reget [-Ppr] remote-path [local-path]
342              Resume download of remote-path.  Equivalent to get with the -a
343              flag set.
344
345      reput [-Ppr] [local-path] remote-path
346              Resume upload of [local-path].  Equivalent to put with the -a
347              flag set.
348
349      rename oldpath newpath
350              Rename remote file from oldpath to newpath.
351
352      rm path
353              Delete remote file specified by path.
354
355      rmdir path
356              Remove remote directory specified by path.
357
358      symlink oldpath newpath
359              Create a symbolic link from oldpath to newpath.
360
361      version
362              Display the sftp protocol version.
363
364      !command
365              Execute command in local shell.
366
367      !       Escape to local shell.
368
369      ?       Synonym for help.
370
371 SEE ALSO
372      ftp(1), ls(1), scp(1), ssh(1), ssh-add(1), ssh-keygen(1), glob(3),
373      ssh_config(5), sftp-server(8), sshd(8)
374
375      T. Ylonen and S. Lehtinen, SSH File Transfer Protocol, draft-ietf-secsh-
376      filexfer-00.txt, January 2001, work in progress material.
377
378 OpenBSD 6.2                    February 23, 2018                   OpenBSD 6.2