1 .\" $OpenBSD: sftp.1,v 1.97 2013/10/20 09:51:26 djm Exp $
4 .\" Copyright (c) 2001 Damien Miller. All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 .Nd secure file transfer program
36 .Op Fl B Ar buffer_size
39 .Op Fl D Ar sftp_server_path
40 .Op Fl F Ar ssh_config
41 .Op Fl i Ar identity_file
43 .Op Fl o Ar ssh_option
45 .Op Fl R Ar num_requests
47 .Op Fl s Ar subsystem | sftp_server
51 .Oo Ar user Ns @ Oc Ns
52 .Ar host Ns Op : Ns Ar
56 .Ar host Ns Oo : Ns Ar dir Ns
61 .Oo Ar user Ns @ Oc Ns Ar host
64 is an interactive file transfer program, similar to
66 which performs all operations over an encrypted
69 It may also use many features of ssh, such as public key authentication and
72 connects and logs into the specified
74 then enters an interactive command mode.
76 The second usage format will retrieve files automatically if a non-interactive
77 authentication method is used; otherwise it will do so after
78 successful interactive authentication.
80 The third usage format allows
82 to start in a remote directory.
84 The final usage format allows for automated sessions using the
87 In such cases, it is necessary to configure non-interactive authentication
88 to obviate the need to enter a password at connection time (see
94 Since some usage formats use colon characters to delimit host names from path
95 names, IPv6 addresses must be enclosed in square brackets to avoid ambiguity.
97 The options are as follows:
100 Specify the use of protocol version 1.
102 Specify the use of protocol version 2.
106 to use IPv4 addresses only.
110 to use IPv6 addresses only.
112 Attempt to continue interrupted downloads rather than overwriting existing
113 partial or complete copies of files.
114 If the remote file contents differ from the partial local copy then the
115 resultant file is likely to be corrupt.
116 .It Fl B Ar buffer_size
117 Specify the size of the buffer that
119 uses when transferring files.
120 Larger buffers require fewer round trips at the cost of higher
122 The default is 32768 bytes.
123 .It Fl b Ar batchfile
124 Batch mode reads a series of commands from an input
128 Since it lacks user interaction it should be used in conjunction with
129 non-interactive authentication.
134 may be used to indicate standard input.
136 will abort if any of the following
138 .Ic get , put , reget , 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
198 .It CanonicalizeFallbackLocal
199 .It CanonicalizeHostname
200 .It CanonicalizeMaxDots
201 .It CanonicalizePermittedCNAMEs
202 .It ChallengeResponseAuthentication
208 .It ConnectionAttempts
213 .It GlobalKnownHostsFile
214 .It GSSAPIAuthentication
215 .It GSSAPIDelegateCredentials
218 .It HostbasedAuthentication
219 .It HostKeyAlgorithms
225 .It KbdInteractiveAuthentication
226 .It KbdInteractiveDevices
230 .It NoHostAuthenticationForLocalhost
231 .It NumberOfPasswordPrompts
232 .It PasswordAuthentication
235 .It PreferredAuthentications
238 .It PubkeyAuthentication
240 .It RhostsRSAAuthentication
241 .It RSAAuthentication
243 .It ServerAliveInterval
244 .It ServerAliveCountMax
245 .It StrictHostKeyChecking
247 .It UsePrivilegedPort
249 .It UserKnownHostsFile
253 Specifies the port to connect to on the remote host.
255 Preserves modification times, access times, and modes from the
256 original files transferred.
258 Quiet mode: disables the progress meter as well as warning and
259 diagnostic messages from
261 .It Fl R Ar num_requests
262 Specify how many requests may be outstanding at any one time.
263 Increasing this may slightly improve file transfer speed
264 but will increase memory usage.
265 The default is 256 outstanding requests providing for 8MB
266 of outstanding data with a 32KB buffer.
268 Recursively copy entire directories when uploading and downloading.
271 does not follow symbolic links encountered in the tree traversal.
275 to use for the encrypted connection.
276 The program must understand
279 .It Fl s Ar subsystem | sftp_server
280 Specifies the SSH2 subsystem or the path for an sftp server
282 A path is useful for using
284 over protocol version 1, or when the remote
286 does not have an sftp subsystem configured.
289 This option is also passed to ssh.
291 .Sh INTERACTIVE COMMANDS
292 Once in interactive mode,
294 understands a set of commands similar to those of
296 Commands are case insensitive.
297 Pathnames that contain spaces must be enclosed in quotes.
298 Any special characters contained within pathnames that are recognized by
300 must be escaped with backslashes
307 Change remote directory to
309 .It Ic chgrp Ar grp Ar path
317 characters and may match multiple files.
319 must be a numeric GID.
320 .It Ic chmod Ar mode Ar path
321 Change permissions of file
328 characters and may match multiple files.
329 .It Ic chown Ar own Ar path
337 characters and may match multiple files.
339 must be a numeric UID.
344 Display usage information for the filesystem holding the current directory
350 flag is specified, the capacity information will be displayed using
351 "human-readable" suffixes.
354 flag requests display of inode information in addition to capacity information.
355 This command is only supported on servers that implement the
356 .Dq statvfs@openssh.com
368 and store it on the local machine.
370 path name is not specified, it is given the same name it has on the
375 characters and may match multiple files.
380 must specify a directory.
384 flag is specified, then attempt to resume partial transfers of existing files.
385 Note that resumption assumes that any partial copy of the local file matches
387 If the remote file contents differ from the partial local copy then the
388 resultant file is likely to be corrupt.
392 flag is specified, then
394 will be called after the file transfer has completed to flush the file
401 flag is specified, then full file permissions and access times are
406 flag is specified then directories will be copied recursively.
409 does not follow symbolic links when performing recursive transfers.
413 Change local directory to
415 .It Ic lls Op Ar ls-options Op Ar path
416 Display local directory listing of either
418 or current directory if
422 may contain any flags supported by the local system's
428 characters and may match multiple files.
429 .It Ic lmkdir Ar path
430 Create local directory specified by
443 flag is specified the created link is a symbolic link, otherwise it is
446 Print local working directory.
451 Display a remote directory listing of either
453 or the current directory if
459 characters and may match multiple files.
461 The following flags are recognized and alter the behaviour of
466 Produce single columnar output.
468 List files beginning with a dot
471 Do not sort the listing.
472 The default sort order is lexicographical.
474 When used with a long format option, use unit suffixes: Byte, Kilobyte,
475 Megabyte, Gigabyte, Terabyte, Petabyte, and Exabyte in order to reduce
476 the number of digits to four or fewer using powers of 2 for sizes (K=1024,
479 Display additional details including permissions
480 and ownership information.
482 Produce a long listing with user and group information presented
485 Reverse the sort order of the listing.
487 Sort the listing by file size.
489 Sort the listing by last modification time.
491 .It Ic lumask Ar umask
495 Create remote directory specified by
498 Toggle display of progress meter.
506 and store it on the remote machine.
507 If the remote path name is not specified, it is given the same name it has
508 on the local machine.
512 characters and may match multiple files.
517 must specify a directory.
521 flag is specified, then a request will be sent to the server to call
523 after the file has been transferred.
524 Note that this is only supported by servers that implement
525 the "fsync@openssh.com" extension.
531 flag is specified, then full file permissions and access times are
536 flag is specified then directories will be copied recursively.
539 does not follow symbolic links when performing recursive transfers.
541 Display remote working directory.
557 .It Ic rename Ar oldpath Ar newpath
558 Rename remote file from
563 Delete remote file specified by
566 Remove remote directory specified by
568 .It Ic symlink Ar oldpath Ar newpath
569 Create a symbolic link from
577 .It Ic \&! Ns Ar command
582 Escape to local shell.
600 .%T "SSH File Transfer Protocol"
601 .%N draft-ietf-secsh-filexfer-00.txt
603 .%O work in progress material