1 .\" $OpenBSD: sftp.1,v 1.120 2018/09/20 06:58:48 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: September 20 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
203 .It CASignatureAlgorithms
205 .It ChallengeResponseAuthentication
209 .It ConnectionAttempts
214 .It GlobalKnownHostsFile
215 .It GSSAPIAuthentication
216 .It GSSAPIDelegateCredentials
219 .It HostbasedAuthentication
220 .It HostbasedKeyTypes
221 .It HostKeyAlgorithms
228 .It KbdInteractiveAuthentication
229 .It KbdInteractiveDevices
233 .It NoHostAuthenticationForLocalhost
234 .It NumberOfPasswordPrompts
235 .It PasswordAuthentication
238 .It PreferredAuthentications
241 .It PubkeyAcceptedKeyTypes
242 .It PubkeyAuthentication
245 .It ServerAliveInterval
246 .It ServerAliveCountMax
248 .It StrictHostKeyChecking
252 .It UserKnownHostsFile
256 Specifies the port to connect to on the remote host.
258 Preserves modification times, access times, and modes from the
259 original files transferred.
261 Quiet mode: disables the progress meter as well as warning and
262 diagnostic messages from
264 .It Fl R Ar num_requests
265 Specify how many requests may be outstanding at any one time.
266 Increasing this may slightly improve file transfer speed
267 but will increase memory usage.
268 The default is 64 outstanding requests.
270 Recursively copy entire directories when uploading and downloading.
273 does not follow symbolic links encountered in the tree traversal.
277 to use for the encrypted connection.
278 The program must understand
281 .It Fl s Ar subsystem | sftp_server
282 Specifies the SSH2 subsystem or the path for an sftp server
284 A path is useful 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
311 is not specified, then change directory to the one the session started in.
312 .It Ic chgrp Ar grp Ar path
320 characters and may match multiple files.
322 must be a numeric GID.
323 .It Ic chmod Ar mode Ar path
324 Change permissions of file
331 characters and may match multiple files.
332 .It Ic chown Ar own Ar path
340 characters and may match multiple files.
342 must be a numeric UID.
347 Display usage information for the filesystem holding the current directory
353 flag is specified, the capacity information will be displayed using
354 "human-readable" suffixes.
357 flag requests display of inode information in addition to capacity information.
358 This command is only supported on servers that implement the
359 .Dq statvfs@openssh.com
371 and store it on the local machine.
373 path name is not specified, it is given the same name it has on the
378 characters and may match multiple files.
383 must specify a directory.
387 flag is specified, then attempt to resume partial transfers of existing files.
388 Note that resumption assumes that any partial copy of the local file matches
390 If the remote file contents differ from the partial local copy then the
391 resultant file is likely to be corrupt.
395 flag is specified, then
397 will be called after the file transfer has completed to flush the file
404 flag is specified, then full file permissions and access times are
409 flag is specified then directories will be copied recursively.
412 does not follow symbolic links when performing recursive transfers.
415 .It Ic lcd Op Ar path
416 Change local directory to
420 is not specified, then change directory to the local user's home directory.
421 .It Ic lls Op Ar ls-options Op Ar path
422 Display local directory listing of either
424 or current directory if
428 may contain any flags supported by the local system's
434 characters and may match multiple files.
435 .It Ic lmkdir Ar path
436 Create local directory specified by
449 flag is specified the created link is a symbolic link, otherwise it is
452 Print local working directory.
457 Display a remote directory listing of either
459 or the current directory if
465 characters and may match multiple files.
467 The following flags are recognized and alter the behaviour of
472 Produce single columnar output.
474 List files beginning with a dot
477 Do not sort the listing.
478 The default sort order is lexicographical.
480 When used with a long format option, use unit suffixes: Byte, Kilobyte,
481 Megabyte, Gigabyte, Terabyte, Petabyte, and Exabyte in order to reduce
482 the number of digits to four or fewer using powers of 2 for sizes (K=1024,
485 Display additional details including permissions
486 and ownership information.
488 Produce a long listing with user and group information presented
491 Reverse the sort order of the listing.
493 Sort the listing by file size.
495 Sort the listing by last modification time.
497 .It Ic lumask Ar umask
501 Create remote directory specified by
504 Toggle display of progress meter.
512 and store it on the remote machine.
513 If the remote path name is not specified, it is given the same name it has
514 on the local machine.
518 characters and may match multiple files.
523 must specify a directory.
527 flag is specified, then attempt to resume partial
528 transfers of existing files.
529 Note that resumption assumes that any partial copy of the remote file
530 matches the local copy.
531 If the local file contents differ from the remote local copy then
532 the resultant file is likely to be corrupt.
536 flag is specified, then a request will be sent to the server to call
538 after the file has been transferred.
539 Note that this is only supported by servers that implement
540 the "fsync@openssh.com" extension.
546 flag is specified, then full file permissions and access times are
551 flag is specified then directories will be copied recursively.
554 does not follow symbolic links when performing recursive transfers.
556 Display remote working directory.
584 .It Ic rename Ar oldpath Ar newpath
585 Rename remote file from
590 Delete remote file specified by
593 Remove remote directory specified by
595 .It Ic symlink Ar oldpath Ar newpath
596 Create a symbolic link from
604 .It Ic \&! Ns Ar command
609 Escape to local shell.
627 .%T "SSH File Transfer Protocol"
628 .%N draft-ietf-secsh-filexfer-00.txt
630 .%O work in progress material