1 .\" $OpenBSD: sftp.1,v 1.119 2018/07/23 19:53:55 jmc Exp $
3 .\" Copyright (c) 2001 Damien Miller. All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 .Dd $Mdocdate: July 23 2018 $
30 .Nd secure file transfer program
34 .Op Fl B Ar buffer_size
37 .Op Fl D Ar sftp_server_path
38 .Op Fl F Ar ssh_config
39 .Op Fl i Ar identity_file
41 .Op Fl o Ar ssh_option
43 .Op Fl R Ar num_requests
45 .Op Fl s Ar subsystem | sftp_server
49 is a file transfer program, similar to
51 which performs all operations over an encrypted
54 It may also use many features of ssh, such as public key authentication and
59 may be specified either as
61 .Oo user @ Oc host Op : path
63 or as a URI in the form
65 .No sftp:// Oo user @ Oc host Oo : port Oc Op / path .
72 and it is not a directory,
74 will retrieve files automatically if a non-interactive
75 authentication method is used; otherwise it will do so after
76 successful interactive authentication.
80 is specified, or if the
84 will log in to the specified
86 and enter interactive command mode, changing to the remote directory
88 An optional trailing slash can be used to force the
90 to be interpreted as a directory.
92 Since the destination formats use colon characters to delimit host
93 names from path names or port numbers, IPv6 addresses must be
94 enclosed in square brackets to avoid ambiguity.
96 The options are as follows:
101 to use IPv4 addresses only.
105 to use IPv6 addresses only.
107 Attempt to continue interrupted transfers rather than overwriting
108 existing partial or complete copies of files.
109 If the partial contents differ from those being transferred,
110 then the resultant file is likely to be corrupt.
111 .It Fl B Ar buffer_size
112 Specify the size of the buffer that
114 uses when transferring files.
115 Larger buffers require fewer round trips at the cost of higher
117 The default is 32768 bytes.
118 .It Fl b Ar batchfile
119 Batch mode reads a series of commands from an input
123 Since it lacks user interaction it should be used in conjunction with
124 non-interactive authentication to obviate the need to enter a password
125 at connection time (see
134 may be used to indicate standard input.
136 will abort if any of the following
138 .Ic get , put , reget , reput, rename , ln ,
139 .Ic rm , mkdir , chdir , ls ,
140 .Ic lchdir , chmod , chown ,
141 .Ic chgrp , lpwd , df , symlink ,
144 Termination on error can be suppressed on a command by command basis by
145 prefixing the command with a
147 character (for example,
148 .Ic -rm /tmp/blah* ) .
150 Enables compression (via ssh's
154 Selects the cipher to use for encrypting the data transfers.
155 This option is directly passed to
157 .It Fl D Ar sftp_server_path
158 Connect directly to a local sftp server
161 This option may be useful in debugging the client and server.
162 .It Fl F Ar ssh_config
163 Specifies an alternative
164 per-user configuration file for
166 This option is directly passed to
169 Requests that files be flushed to disk immediately after transfer.
170 When uploading files, this feature is only enabled if the server
171 implements the "fsync@openssh.com" extension.
172 .It Fl i Ar identity_file
173 Selects the file from which the identity (private key) for public key
174 authentication is read.
175 This option is directly passed to
178 Limits the used bandwidth, specified in Kbit/s.
179 .It Fl o Ar ssh_option
180 Can be used to pass options to
182 in the format used in
184 This is useful for specifying options
185 for which there is no separate
188 For example, to specify an alternate port use:
190 For full details of the options listed below, and their possible values, see
193 .Bl -tag -width Ds -offset indent -compact
199 .It CanonicalizeFallbackLocal
200 .It CanonicalizeHostname
201 .It CanonicalizeMaxDots
202 .It CanonicalizePermittedCNAMEs
204 .It ChallengeResponseAuthentication
208 .It ConnectionAttempts
213 .It GlobalKnownHostsFile
214 .It GSSAPIAuthentication
215 .It GSSAPIDelegateCredentials
218 .It HostbasedAuthentication
219 .It HostbasedKeyTypes
220 .It HostKeyAlgorithms
227 .It KbdInteractiveAuthentication
228 .It KbdInteractiveDevices
232 .It NoHostAuthenticationForLocalhost
233 .It NumberOfPasswordPrompts
234 .It PasswordAuthentication
237 .It PreferredAuthentications
240 .It PubkeyAcceptedKeyTypes
241 .It PubkeyAuthentication
244 .It ServerAliveInterval
245 .It ServerAliveCountMax
247 .It StrictHostKeyChecking
251 .It UserKnownHostsFile
255 Specifies the port to connect to on the remote host.
257 Preserves modification times, access times, and modes from the
258 original files transferred.
260 Quiet mode: disables the progress meter as well as warning and
261 diagnostic messages from
263 .It Fl R Ar num_requests
264 Specify how many requests may be outstanding at any one time.
265 Increasing this may slightly improve file transfer speed
266 but will increase memory usage.
267 The default is 64 outstanding requests.
269 Recursively copy entire directories when uploading and downloading.
272 does not follow symbolic links encountered in the tree traversal.
276 to use for the encrypted connection.
277 The program must understand
280 .It Fl s Ar subsystem | sftp_server
281 Specifies the SSH2 subsystem or the path for an sftp server
283 A path is useful when the remote
285 does not have an sftp subsystem configured.
288 This option is also passed to ssh.
290 .Sh INTERACTIVE COMMANDS
291 Once in interactive mode,
293 understands a set of commands similar to those of
295 Commands are case insensitive.
296 Pathnames that contain spaces must be enclosed in quotes.
297 Any special characters contained within pathnames that are recognized by
299 must be escaped with backslashes
306 Change remote directory to
310 is not specified, then change directory to the one the session started in.
311 .It Ic chgrp Ar grp Ar path
319 characters and may match multiple files.
321 must be a numeric GID.
322 .It Ic chmod Ar mode Ar path
323 Change permissions of file
330 characters and may match multiple files.
331 .It Ic chown Ar own Ar path
339 characters and may match multiple files.
341 must be a numeric UID.
346 Display usage information for the filesystem holding the current directory
352 flag is specified, the capacity information will be displayed using
353 "human-readable" suffixes.
356 flag requests display of inode information in addition to capacity information.
357 This command is only supported on servers that implement the
358 .Dq statvfs@openssh.com
370 and store it on the local machine.
372 path name is not specified, it is given the same name it has on the
377 characters and may match multiple files.
382 must specify a directory.
386 flag is specified, then attempt to resume partial transfers of existing files.
387 Note that resumption assumes that any partial copy of the local file matches
389 If the remote file contents differ from the partial local copy then the
390 resultant file is likely to be corrupt.
394 flag is specified, then
396 will be called after the file transfer has completed to flush the file
403 flag is specified, then full file permissions and access times are
408 flag is specified then directories will be copied recursively.
411 does not follow symbolic links when performing recursive transfers.
414 .It Ic lcd Op Ar path
415 Change local directory to
419 is not specified, then change directory to the local user's home directory.
420 .It Ic lls Op Ar ls-options Op Ar path
421 Display local directory listing of either
423 or current directory if
427 may contain any flags supported by the local system's
433 characters and may match multiple files.
434 .It Ic lmkdir Ar path
435 Create local directory specified by
448 flag is specified the created link is a symbolic link, otherwise it is
451 Print local working directory.
456 Display a remote directory listing of either
458 or the current directory if
464 characters and may match multiple files.
466 The following flags are recognized and alter the behaviour of
471 Produce single columnar output.
473 List files beginning with a dot
476 Do not sort the listing.
477 The default sort order is lexicographical.
479 When used with a long format option, use unit suffixes: Byte, Kilobyte,
480 Megabyte, Gigabyte, Terabyte, Petabyte, and Exabyte in order to reduce
481 the number of digits to four or fewer using powers of 2 for sizes (K=1024,
484 Display additional details including permissions
485 and ownership information.
487 Produce a long listing with user and group information presented
490 Reverse the sort order of the listing.
492 Sort the listing by file size.
494 Sort the listing by last modification time.
496 .It Ic lumask Ar umask
500 Create remote directory specified by
503 Toggle display of progress meter.
511 and store it on the remote machine.
512 If the remote path name is not specified, it is given the same name it has
513 on the local machine.
517 characters and may match multiple files.
522 must specify a directory.
526 flag is specified, then attempt to resume partial
527 transfers of existing files.
528 Note that resumption assumes that any partial copy of the remote file
529 matches the local copy.
530 If the local file contents differ from the remote local copy then
531 the resultant file is likely to be corrupt.
535 flag is specified, then a request will be sent to the server to call
537 after the file has been transferred.
538 Note that this is only supported by servers that implement
539 the "fsync@openssh.com" extension.
545 flag is specified, then full file permissions and access times are
550 flag is specified then directories will be copied recursively.
553 does not follow symbolic links when performing recursive transfers.
555 Display remote working directory.
583 .It Ic rename Ar oldpath Ar newpath
584 Rename remote file from
589 Delete remote file specified by
592 Remove remote directory specified by
594 .It Ic symlink Ar oldpath Ar newpath
595 Create a symbolic link from
603 .It Ic \&! Ns Ar command
608 Escape to local shell.
626 .%T "SSH File Transfer Protocol"
627 .%N draft-ietf-secsh-filexfer-00.txt
629 .%O work in progress material