1 .\" $OpenBSD: sftp.1,v 1.110 2017/05/03 21:49:18 naddy 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: May 3 2017 $
30 .Nd secure file transfer program
35 .Op Fl B Ar buffer_size
38 .Op Fl D Ar sftp_server_path
39 .Op Fl F Ar ssh_config
40 .Op Fl i Ar identity_file
42 .Op Fl o Ar ssh_option
44 .Op Fl R Ar num_requests
46 .Op Fl s Ar subsystem | sftp_server
50 .Oo Ar user Ns @ Oc Ns
51 .Ar host Ns Op : Ns Ar
55 .Ar host Ns Oo : Ns Ar dir Ns
60 .Oo Ar user Ns @ Oc Ns Ar host
63 is an interactive file transfer program, similar to
65 which performs all operations over an encrypted
68 It may also use many features of ssh, such as public key authentication and
71 connects and logs into the specified
73 then enters an interactive command mode.
75 The second usage format will retrieve files automatically if a non-interactive
76 authentication method is used; otherwise it will do so after
77 successful interactive authentication.
79 The third usage format allows
81 to start in a remote directory.
83 The final usage format allows for automated sessions using the
86 In such cases, it is necessary to configure non-interactive authentication
87 to obviate the need to enter a password at connection time (see
93 Since some usage formats use colon characters to delimit host names from path
94 names, IPv6 addresses must be 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.
129 may be used to indicate standard input.
131 will abort if any of the following
133 .Ic get , put , reget , reput, rename , ln ,
134 .Ic rm , mkdir , chdir , ls ,
135 .Ic lchdir , chmod , chown ,
136 .Ic chgrp , lpwd , df , symlink ,
139 Termination on error can be suppressed on a command by command basis by
140 prefixing the command with a
142 character (for example,
143 .Ic -rm /tmp/blah* ) .
145 Enables compression (via ssh's
149 Selects the cipher to use for encrypting the data transfers.
150 This option is directly passed to
152 .It Fl D Ar sftp_server_path
153 Connect directly to a local sftp server
156 This option may be useful in debugging the client and server.
157 .It Fl F Ar ssh_config
158 Specifies an alternative
159 per-user configuration file for
161 This option is directly passed to
164 Requests that files be flushed to disk immediately after transfer.
165 When uploading files, this feature is only enabled if the server
166 implements the "fsync@openssh.com" extension.
167 .It Fl i Ar identity_file
168 Selects the file from which the identity (private key) for public key
169 authentication is read.
170 This option is directly passed to
173 Limits the used bandwidth, specified in Kbit/s.
174 .It Fl o Ar ssh_option
175 Can be used to pass options to
177 in the format used in
179 This is useful for specifying options
180 for which there is no separate
183 For example, to specify an alternate port use:
185 For full details of the options listed below, and their possible values, see
188 .Bl -tag -width Ds -offset indent -compact
193 .It CanonicalizeFallbackLocal
194 .It CanonicalizeHostname
195 .It CanonicalizeMaxDots
196 .It CanonicalizePermittedCNAMEs
198 .It ChallengeResponseAuthentication
202 .It ConnectionAttempts
207 .It GlobalKnownHostsFile
208 .It GSSAPIAuthentication
209 .It GSSAPIDelegateCredentials
212 .It HostbasedAuthentication
213 .It HostbasedKeyTypes
214 .It HostKeyAlgorithms
221 .It KbdInteractiveAuthentication
222 .It KbdInteractiveDevices
226 .It NoHostAuthenticationForLocalhost
227 .It NumberOfPasswordPrompts
228 .It PasswordAuthentication
231 .It PreferredAuthentications
234 .It PubkeyAcceptedKeyTypes
235 .It PubkeyAuthentication
238 .It ServerAliveInterval
239 .It ServerAliveCountMax
240 .It StrictHostKeyChecking
243 .It UsePrivilegedPort
245 .It UserKnownHostsFile
249 Specifies the port to connect to on the remote host.
251 Preserves modification times, access times, and modes from the
252 original files transferred.
254 Quiet mode: disables the progress meter as well as warning and
255 diagnostic messages from
257 .It Fl R Ar num_requests
258 Specify how many requests may be outstanding at any one time.
259 Increasing this may slightly improve file transfer speed
260 but will increase memory usage.
261 The default is 64 outstanding requests.
263 Recursively copy entire directories when uploading and downloading.
266 does not follow symbolic links encountered in the tree traversal.
270 to use for the encrypted connection.
271 The program must understand
274 .It Fl s Ar subsystem | sftp_server
275 Specifies the SSH2 subsystem or the path for an sftp server
277 A path is useful when the remote
279 does not have an sftp subsystem configured.
282 This option is also passed to ssh.
284 .Sh INTERACTIVE COMMANDS
285 Once in interactive mode,
287 understands a set of commands similar to those of
289 Commands are case insensitive.
290 Pathnames that contain spaces must be enclosed in quotes.
291 Any special characters contained within pathnames that are recognized by
293 must be escaped with backslashes
300 Change remote directory to
302 .It Ic chgrp Ar grp Ar path
310 characters and may match multiple files.
312 must be a numeric GID.
313 .It Ic chmod Ar mode Ar path
314 Change permissions of file
321 characters and may match multiple files.
322 .It Ic chown Ar own Ar path
330 characters and may match multiple files.
332 must be a numeric UID.
337 Display usage information for the filesystem holding the current directory
343 flag is specified, the capacity information will be displayed using
344 "human-readable" suffixes.
347 flag requests display of inode information in addition to capacity information.
348 This command is only supported on servers that implement the
349 .Dq statvfs@openssh.com
361 and store it on the local machine.
363 path name is not specified, it is given the same name it has on the
368 characters and may match multiple files.
373 must specify a directory.
377 flag is specified, then attempt to resume partial transfers of existing files.
378 Note that resumption assumes that any partial copy of the local file matches
380 If the remote file contents differ from the partial local copy then the
381 resultant file is likely to be corrupt.
385 flag is specified, then
387 will be called after the file transfer has completed to flush the file
394 flag is specified, then full file permissions and access times are
399 flag is specified then directories will be copied recursively.
402 does not follow symbolic links when performing recursive transfers.
406 Change local directory to
408 .It Ic lls Op Ar ls-options Op Ar path
409 Display local directory listing of either
411 or current directory if
415 may contain any flags supported by the local system's
421 characters and may match multiple files.
422 .It Ic lmkdir Ar path
423 Create local directory specified by
436 flag is specified the created link is a symbolic link, otherwise it is
439 Print local working directory.
444 Display a remote directory listing of either
446 or the current directory if
452 characters and may match multiple files.
454 The following flags are recognized and alter the behaviour of
459 Produce single columnar output.
461 List files beginning with a dot
464 Do not sort the listing.
465 The default sort order is lexicographical.
467 When used with a long format option, use unit suffixes: Byte, Kilobyte,
468 Megabyte, Gigabyte, Terabyte, Petabyte, and Exabyte in order to reduce
469 the number of digits to four or fewer using powers of 2 for sizes (K=1024,
472 Display additional details including permissions
473 and ownership information.
475 Produce a long listing with user and group information presented
478 Reverse the sort order of the listing.
480 Sort the listing by file size.
482 Sort the listing by last modification time.
484 .It Ic lumask Ar umask
488 Create remote directory specified by
491 Toggle display of progress meter.
499 and store it on the remote machine.
500 If the remote path name is not specified, it is given the same name it has
501 on the local machine.
505 characters and may match multiple files.
510 must specify a directory.
514 flag is specified, then attempt to resume partial
515 transfers of existing files.
516 Note that resumption assumes that any partial copy of the remote file
517 matches the local copy.
518 If the local file contents differ from the remote local copy then
519 the resultant file is likely to be corrupt.
523 flag is specified, then a request will be sent to the server to call
525 after the file has been transferred.
526 Note that this is only supported by servers that implement
527 the "fsync@openssh.com" extension.
533 flag is specified, then full file permissions and access times are
538 flag is specified then directories will be copied recursively.
541 does not follow symbolic links when performing recursive transfers.
543 Display remote working directory.
571 .It Ic rename Ar oldpath Ar newpath
572 Rename remote file from
577 Delete remote file specified by
580 Remove remote directory specified by
582 .It Ic symlink Ar oldpath Ar newpath
583 Create a symbolic link from
591 .It Ic \&! Ns Ar command
596 Escape to local shell.
614 .%T "SSH File Transfer Protocol"
615 .%N draft-ietf-secsh-filexfer-00.txt
617 .%O work in progress material