blob: a52c1cff3a7a1c60196e7f1c32cd590e69ee8e3f [file] [log] [blame]
jmc@openbsd.org5f68ab42019-06-19 20:12:44 +00001.\" $OpenBSD: sftp.1,v 1.127 2019/06/19 20:12:44 jmc Exp $
Damien Miller33804262001-02-04 23:20:18 +11002.\"
Ben Lindstrom92a2e382001-03-05 06:59:27 +00003.\" Copyright (c) 2001 Damien Miller. All rights reserved.
Damien Miller33804262001-02-04 23:20:18 +11004.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
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.
13.\"
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.
24.\"
jmc@openbsd.org5f68ab42019-06-19 20:12:44 +000025.Dd $Mdocdate: June 19 2019 $
Damien Miller33804262001-02-04 23:20:18 +110026.Dt SFTP 1
27.Os
28.Sh NAME
29.Nm sftp
Damien Miller50677922003-05-23 18:44:04 +100030.Nd secure file transfer program
Damien Miller33804262001-02-04 23:20:18 +110031.Sh SYNOPSIS
Damien Millerd6ead282003-05-14 19:30:38 +100032.Nm sftp
djm@openbsd.org3575f0b2017-05-02 08:54:19 +000033.Op Fl 46aCfpqrv
Damien Miller81b6e782002-02-08 22:06:03 +110034.Op Fl B Ar buffer_size
Darren Tucker1f203942003-10-15 15:50:42 +100035.Op Fl b Ar batchfile
Darren Tucker46bbbe32009-10-07 08:21:48 +110036.Op Fl c Ar cipher
Darren Tucker282b4022009-10-07 08:23:06 +110037.Op Fl D Ar sftp_server_path
Damien Miller81b6e782002-02-08 22:06:03 +110038.Op Fl F Ar ssh_config
Darren Tuckerc07138e2009-10-07 08:23:44 +110039.Op Fl i Ar identity_file
tb@openbsd.org622dedf2019-01-21 22:50:42 +000040.Op Fl J Ar destination
Damien Miller65e42f82010-09-24 22:15:11 +100041.Op Fl l Ar limit
Darren Tucker1f203942003-10-15 15:50:42 +100042.Op Fl o Ar ssh_option
Darren Tucker282b4022009-10-07 08:23:06 +110043.Op Fl P Ar port
Damien Miller16a13332002-02-13 14:03:56 +110044.Op Fl R Ar num_requests
Ben Lindstrom6a337632001-09-18 05:47:32 +000045.Op Fl S Ar program
Darren Tucker1f203942003-10-15 15:50:42 +100046.Op Fl s Ar subsystem | sftp_server
millert@openbsd.org887669e2017-10-21 23:06:24 +000047.Ar destination
Damien Miller33804262001-02-04 23:20:18 +110048.Sh DESCRIPTION
49.Nm
millert@openbsd.org887669e2017-10-21 23:06:24 +000050is a file transfer program, similar to
Damien Miller33804262001-02-04 23:20:18 +110051.Xr ftp 1 ,
52which performs all operations over an encrypted
53.Xr ssh 1
54transport.
55It may also use many features of ssh, such as public key authentication and
56compression.
Damien Miller33804262001-02-04 23:20:18 +110057.Pp
millert@openbsd.org887669e2017-10-21 23:06:24 +000058The
59.Ar destination
60may be specified either as
jmc@openbsd.org@openbsd.org0b2e2892017-10-25 06:19:46 +000061.Sm off
62.Oo user @ Oc host Op : path
63.Sm on
64or as a URI in the form
65.Sm off
66.No sftp:// Oo user @ Oc host Oo : port Oc Op / path .
67.Sm on
millert@openbsd.org887669e2017-10-21 23:06:24 +000068.Pp
69If the
70.Ar destination
71includes a
72.Ar path
73and it is not a directory,
74.Nm
75will retrieve files automatically if a non-interactive
Ben Lindstromaafff9c2001-05-06 03:01:02 +000076authentication method is used; otherwise it will do so after
77successful interactive authentication.
Ben Lindstrom63667f62001-04-13 00:00:14 +000078.Pp
millert@openbsd.org887669e2017-10-21 23:06:24 +000079If no
80.Ar path
81is specified, or if the
82.Ar path
83is a directory,
Darren Tucker16e254d2004-12-06 22:46:45 +110084.Nm
millert@openbsd.org887669e2017-10-21 23:06:24 +000085will log in to the specified
86.Ar host
87and enter interactive command mode, changing to the remote directory
88if one was specified.
89An optional trailing slash can be used to force the
90.Ar path
91to be interpreted as a directory.
Ben Lindstrom63667f62001-04-13 00:00:14 +000092.Pp
millert@openbsd.org887669e2017-10-21 23:06:24 +000093Since the destination formats use colon characters to delimit host
94names from path names or port numbers, IPv6 addresses must be
95enclosed in square brackets to avoid ambiguity.
Damien Miller58a77e22011-05-15 08:36:29 +100096.Pp
Damien Miller33804262001-02-04 23:20:18 +110097The options are as follows:
98.Bl -tag -width Ds
Darren Tucker46bbbe32009-10-07 08:21:48 +110099.It Fl 4
100Forces
101.Nm
102to use IPv4 addresses only.
103.It Fl 6
104Forces
105.Nm
106to use IPv6 addresses only.
Damien Millerc6895c52013-08-21 02:40:21 +1000107.It Fl a
Damien Miller798a0252014-05-15 13:47:37 +1000108Attempt to continue interrupted transfers rather than overwriting
Damien Millerd875ff72014-05-15 13:47:15 +1000109existing partial or complete copies of files.
Damien Miller798a0252014-05-15 13:47:37 +1000110If the partial contents differ from those being transferred,
Damien Millerd875ff72014-05-15 13:47:15 +1000111then the resultant file is likely to be corrupt.
Darren Tucker1f203942003-10-15 15:50:42 +1000112.It Fl B Ar buffer_size
113Specify the size of the buffer that
114.Nm
115uses when transferring files.
116Larger buffers require fewer round trips at the cost of higher
117memory consumption.
118The default is 32768 bytes.
Ben Lindstrom562c26b2001-03-07 01:26:48 +0000119.It Fl b Ar batchfile
120Batch mode reads a series of commands from an input
Ben Lindstrom283cb822001-03-09 00:09:02 +0000121.Ar batchfile
Ben Lindstrom562c26b2001-03-07 01:26:48 +0000122instead of
Ben Lindstrom283cb822001-03-09 00:09:02 +0000123.Em stdin .
124Since it lacks user interaction it should be used in conjunction with
millert@openbsd.org887669e2017-10-21 23:06:24 +0000125non-interactive authentication to obviate the need to enter a password
126at connection time (see
127.Xr sshd 8
128and
129.Xr ssh-keygen 1
130for details).
djm@openbsd.org5c1a6352018-11-16 02:30:20 +0000131.Pp
Damien Miller44f75c12004-01-21 10:58:47 +1100132A
Damien Miller86a39682004-01-21 11:00:04 +1100133.Ar batchfile
134of
135.Sq \-
Damien Miller44f75c12004-01-21 10:58:47 +1100136may be used to indicate standard input.
Ben Lindstrom283cb822001-03-09 00:09:02 +0000137.Nm
Ben Lindstrom24643222001-06-25 05:08:11 +0000138will abort if any of the following
139commands fail:
schwarze@openbsd.org90ef45f2018-11-13 07:22:45 +0000140.Ic get , put , reget , reput , rename , ln ,
Damien Miller495dca32003-04-01 21:42:14 +1000141.Ic rm , mkdir , chdir , ls ,
Damien Miller64058cb2008-05-19 14:54:25 +1000142.Ic lchdir , chmod , chown ,
Darren Tuckeraf1f9092010-12-05 09:02:47 +1100143.Ic chgrp , lpwd , df , symlink ,
Ben Lindstrom562c26b2001-03-07 01:26:48 +0000144and
Ben Lindstrom283cb822001-03-09 00:09:02 +0000145.Ic lmkdir .
djm@openbsd.org5c1a6352018-11-16 02:30:20 +0000146.Pp
Damien Miller495dca32003-04-01 21:42:14 +1000147Termination on error can be suppressed on a command by command basis by
148prefixing the command with a
Damien Miller86a39682004-01-21 11:00:04 +1100149.Sq \-
Damien Miller50677922003-05-23 18:44:04 +1000150character (for example,
151.Ic -rm /tmp/blah* ) .
djm@openbsd.org5c1a6352018-11-16 02:30:20 +0000152Echo of the command may be suppressed by prefixing the command with a
153.Sq @
154character.
155These two prefixes may be combined in any order, for example
156.Ic -@ls /bsd .
Darren Tucker1f203942003-10-15 15:50:42 +1000157.It Fl C
158Enables compression (via ssh's
159.Fl C
160flag).
Darren Tuckeradba1ba2009-10-07 08:22:20 +1100161.It Fl c Ar cipher
162Selects the cipher to use for encrypting the data transfers.
163This option is directly passed to
164.Xr ssh 1 .
Darren Tucker282b4022009-10-07 08:23:06 +1100165.It Fl D Ar sftp_server_path
166Connect directly to a local sftp server
167(rather than via
168.Xr ssh 1 ) .
169This option may be useful in debugging the client and server.
Darren Tucker1f203942003-10-15 15:50:42 +1000170.It Fl F Ar ssh_config
171Specifies an alternative
172per-user configuration file for
173.Xr ssh 1 .
174This option is directly passed to
175.Xr ssh 1 .
Damien Millerf29238e2013-10-17 11:48:52 +1100176.It Fl f
177Requests that files be flushed to disk immediately after transfer.
178When uploading files, this feature is only enabled if the server
179implements the "fsync@openssh.com" extension.
Darren Tucker46bbbe32009-10-07 08:21:48 +1100180.It Fl i Ar identity_file
181Selects the file from which the identity (private key) for public key
182authentication is read.
183This option is directly passed to
184.Xr ssh 1 .
tb@openbsd.org622dedf2019-01-21 22:50:42 +0000185.It Fl J Ar destination
jmc@openbsd.orgfd8eb132019-01-22 06:58:31 +0000186Connect to the target host by first making an
tb@openbsd.org622dedf2019-01-21 22:50:42 +0000187.Nm
188connection to the jump host described by
189.Ar destination
190and then establishing a TCP forwarding to the ultimate destination from
191there.
192Multiple jump hops may be specified separated by comma characters.
193This is a shortcut to specify a
194.Cm ProxyJump
195configuration directive.
196This option is directly passed to
197.Xr ssh 1 .
Damien Miller65e42f82010-09-24 22:15:11 +1000198.It Fl l Ar limit
199Limits the used bandwidth, specified in Kbit/s.
Damien Miller33804262001-02-04 23:20:18 +1100200.It Fl o Ar ssh_option
Ben Lindstrom14c62eb2001-08-15 23:25:46 +0000201Can be used to pass options to
202.Nm ssh
Ben Lindstrom3072aae2002-06-21 01:02:39 +0000203in the format used in
204.Xr ssh_config 5 .
205This is useful for specifying options
Ben Lindstrom14c62eb2001-08-15 23:25:46 +0000206for which there is no separate
207.Nm sftp
Damien Miller50677922003-05-23 18:44:04 +1000208command-line flag.
209For example, to specify an alternate port use:
Ben Lindstrom6a337632001-09-18 05:47:32 +0000210.Ic sftp -oPort=24 .
Darren Tucker1f203942003-10-15 15:50:42 +1000211For full details of the options listed below, and their possible values, see
212.Xr ssh_config 5 .
213.Pp
214.Bl -tag -width Ds -offset indent -compact
215.It AddressFamily
216.It BatchMode
217.It BindAddress
jmc@openbsd.org7d330a12018-02-23 07:38:09 +0000218.It BindInterface
Damien Millerc0049bd2013-10-23 16:29:59 +1100219.It CanonicalDomains
220.It CanonicalizeFallbackLocal
221.It CanonicalizeHostname
222.It CanonicalizeMaxDots
223.It CanonicalizePermittedCNAMEs
jmc@openbsd.orge6933a22018-09-20 06:58:48 +0000224.It CASignatureAlgorithms
jmc@openbsd.orgc5f7c082015-09-25 18:19:54 +0000225.It CertificateFile
Darren Tucker1f203942003-10-15 15:50:42 +1000226.It ChallengeResponseAuthentication
227.It CheckHostIP
Darren Tucker1f203942003-10-15 15:50:42 +1000228.It Ciphers
Darren Tucker1f203942003-10-15 15:50:42 +1000229.It Compression
naddy@openbsd.org9a82e242017-05-03 21:49:18 +0000230.It ConnectionAttempts
Darren Tucker3d5cbb72004-05-03 09:13:15 +1000231.It ConnectTimeout
Damien Miller0e220db2004-06-15 10:34:08 +1000232.It ControlMaster
233.It ControlPath
Damien Millere5777722011-09-22 21:34:15 +1000234.It ControlPersist
Darren Tucker1f203942003-10-15 15:50:42 +1000235.It GlobalKnownHostsFile
236.It GSSAPIAuthentication
237.It GSSAPIDelegateCredentials
Damien Miller27e9c512005-03-02 12:04:16 +1100238.It HashKnownHosts
Darren Tucker1f203942003-10-15 15:50:42 +1000239.It Host
240.It HostbasedAuthentication
djm@openbsd.org46347ed2015-01-30 11:43:14 +0000241.It HostbasedKeyTypes
Darren Tucker1f203942003-10-15 15:50:42 +1000242.It HostKeyAlgorithms
243.It HostKeyAlias
jmc@openbsd.org73491492019-06-12 11:31:50 +0000244.It Hostname
jmc@openbsd.org772e6ce2016-06-29 17:14:28 +0000245.It IdentitiesOnly
markus@openbsd.org75e21682016-05-04 14:32:26 +0000246.It IdentityAgent
Darren Tucker1f203942003-10-15 15:50:42 +1000247.It IdentityFile
Damien Miller0a184732010-11-20 15:21:03 +1100248.It IPQoS
Damien Millere5777722011-09-22 21:34:15 +1000249.It KbdInteractiveAuthentication
Darren Tucker636ca902004-11-05 20:22:00 +1100250.It KbdInteractiveDevices
Damien Miller2beb32f2010-09-24 22:16:03 +1000251.It KexAlgorithms
Darren Tucker1f203942003-10-15 15:50:42 +1000252.It LogLevel
253.It MACs
254.It NoHostAuthenticationForLocalhost
255.It NumberOfPasswordPrompts
256.It PasswordAuthentication
Damien Miller7ea845e2010-02-12 09:21:02 +1100257.It PKCS11Provider
Darren Tucker1f203942003-10-15 15:50:42 +1000258.It Port
259.It PreferredAuthentications
Darren Tucker1f203942003-10-15 15:50:42 +1000260.It ProxyCommand
jmc@openbsd.orge4eb7d92016-07-16 06:57:55 +0000261.It ProxyJump
jmc@openbsd.org42b690b2017-05-02 14:06:37 +0000262.It PubkeyAcceptedKeyTypes
Darren Tucker1f203942003-10-15 15:50:42 +1000263.It PubkeyAuthentication
Darren Tucker62388b22006-01-20 11:31:47 +1100264.It RekeyLimit
Darren Tucker7a6c0662004-05-02 22:14:03 +1000265.It SendEnv
Damien Miller509b0102003-12-17 16:33:10 +1100266.It ServerAliveInterval
267.It ServerAliveCountMax
jmc@openbsd.orgacf42602018-06-09 06:36:31 +0000268.It SetEnv
Darren Tucker1f203942003-10-15 15:50:42 +1000269.It StrictHostKeyChecking
Damien Miller12c150e2003-12-17 16:31:10 +1100270.It TCPKeepAlive
djm@openbsd.org1d1092b2015-01-26 12:16:36 +0000271.It UpdateHostKeys
Darren Tucker1f203942003-10-15 15:50:42 +1000272.It User
273.It UserKnownHostsFile
274.It VerifyHostKeyDNS
Darren Tucker1f203942003-10-15 15:50:42 +1000275.El
Darren Tucker282b4022009-10-07 08:23:06 +1100276.It Fl P Ar port
277Specifies the port to connect to on the remote host.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100278.It Fl p
279Preserves modification times, access times, and modes from the
280original files transferred.
Darren Tucker46bbbe32009-10-07 08:21:48 +1100281.It Fl q
282Quiet mode: disables the progress meter as well as warning and
283diagnostic messages from
284.Xr ssh 1 .
Damien Miller16a13332002-02-13 14:03:56 +1100285.It Fl R Ar num_requests
Damien Miller50677922003-05-23 18:44:04 +1000286Specify how many requests may be outstanding at any one time.
287Increasing this may slightly improve file transfer speed
288but will increase memory usage.
Damien Miller94717b02008-07-16 21:17:23 +1000289The default is 64 outstanding requests.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100290.It Fl r
291Recursively copy entire directories when uploading and downloading.
292Note that
293.Nm
294does not follow symbolic links encountered in the tree traversal.
Ben Lindstrom6a337632001-09-18 05:47:32 +0000295.It Fl S Ar program
296Name of the
297.Ar program
298to use for the encrypted connection.
299The program must understand
300.Xr ssh 1
301options.
Darren Tucker1f203942003-10-15 15:50:42 +1000302.It Fl s Ar subsystem | sftp_server
303Specifies the SSH2 subsystem or the path for an sftp server
304on the remote host.
jmc@openbsd.org2b6f7992017-05-03 06:32:02 +0000305A path is useful when the remote
Darren Tucker1f203942003-10-15 15:50:42 +1000306.Xr sshd 8
307does not have an sftp subsystem configured.
308.It Fl v
309Raise logging level.
310This option is also passed to ssh.
Damien Miller33804262001-02-04 23:20:18 +1100311.El
312.Sh INTERACTIVE COMMANDS
Damien Millerd7686fd2001-02-10 00:40:03 +1100313Once in interactive mode,
314.Nm
Ben Lindstrom24643222001-06-25 05:08:11 +0000315understands a set of commands similar to those of
Damien Miller33804262001-02-04 23:20:18 +1100316.Xr ftp 1 .
Darren Tucker16e254d2004-12-06 22:46:45 +1100317Commands are case insensitive.
318Pathnames that contain spaces must be enclosed in quotes.
319Any special characters contained within pathnames that are recognized by
320.Xr glob 3
321must be escaped with backslashes
322.Pq Sq \e .
323.Bl -tag -width Ds
Ben Lindstrom59e12492001-08-15 23:22:56 +0000324.It Ic bye
Damien Miller50677922003-05-23 18:44:04 +1000325Quit
326.Nm sftp .
djm@openbsd.org@openbsd.orgfbe8e7a2017-11-03 03:46:52 +0000327.It Ic cd Op Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000328Change remote directory to
Damien Millerd7686fd2001-02-10 00:40:03 +1100329.Ar path .
djm@openbsd.org@openbsd.orgfbe8e7a2017-11-03 03:46:52 +0000330If
331.Ar path
332is not specified, then change directory to the one the session started in.
djm@openbsd.org60d8c842019-01-16 23:23:45 +0000333.It Xo Ic chgrp
334.Op Fl h
335.Ar grp
336.Ar path
337.Xc
Ben Lindstrom24643222001-06-25 05:08:11 +0000338Change group of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100339.Ar path
340to
Damien Miller33804262001-02-04 23:20:18 +1100341.Ar grp .
djm@openbsd.org60d8c842019-01-16 23:23:45 +0000342If the
343.Fl h
344flag is specified, then symlinks will not be followed.
Darren Tucker16e254d2004-12-06 22:46:45 +1100345.Ar path
346may contain
kn@openbsd.orgddf1b792018-07-23 19:02:49 +0000347.Xr glob 7
Darren Tucker16e254d2004-12-06 22:46:45 +1100348characters and may match multiple files.
Damien Miller33804262001-02-04 23:20:18 +1100349.Ar grp
Damien Millerd7686fd2001-02-10 00:40:03 +1100350must be a numeric GID.
djm@openbsd.org60d8c842019-01-16 23:23:45 +0000351.It Xo Ic chmod
352.Op Fl h
353.Ar mode
354.Ar path
355.Xc
Ben Lindstrom24643222001-06-25 05:08:11 +0000356Change permissions of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100357.Ar path
358to
359.Ar mode .
djm@openbsd.org60d8c842019-01-16 23:23:45 +0000360If the
361.Fl h
362flag is specified, then symlinks will not be followed.
Darren Tucker16e254d2004-12-06 22:46:45 +1100363.Ar path
364may contain
kn@openbsd.orgddf1b792018-07-23 19:02:49 +0000365.Xr glob 7
Darren Tucker16e254d2004-12-06 22:46:45 +1100366characters and may match multiple files.
djm@openbsd.org60d8c842019-01-16 23:23:45 +0000367.It Xo Ic chown
368.Op Fl h
369.Ar own
370.Ar path
371.Xc
Ben Lindstrom24643222001-06-25 05:08:11 +0000372Change owner of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100373.Ar path
374to
Damien Miller33804262001-02-04 23:20:18 +1100375.Ar own .
djm@openbsd.org60d8c842019-01-16 23:23:45 +0000376If the
377.Fl h
378flag is specified, then symlinks will not be followed.
Darren Tucker16e254d2004-12-06 22:46:45 +1100379.Ar path
380may contain
kn@openbsd.orgddf1b792018-07-23 19:02:49 +0000381.Xr glob 7
Darren Tucker16e254d2004-12-06 22:46:45 +1100382characters and may match multiple files.
Damien Miller33804262001-02-04 23:20:18 +1100383.Ar own
384must be a numeric UID.
Damien Millerd671e5a2008-05-19 14:53:33 +1000385.It Xo Ic df
386.Op Fl hi
387.Op Ar path
388.Xc
389Display usage information for the filesystem holding the current directory
390(or
391.Ar path
392if specified).
393If the
394.Fl h
395flag is specified, the capacity information will be displayed using
396"human-readable" suffixes.
397The
398.Fl i
399flag requests display of inode information in addition to capacity information.
400This command is only supported on servers that implement the
401.Dq statvfs@openssh.com
402extension.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000403.It Ic exit
Damien Miller50677922003-05-23 18:44:04 +1000404Quit
405.Nm sftp .
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000406.It Xo Ic get
jmc@openbsd.org5f68ab42019-06-19 20:12:44 +0000407.Op Fl afpR
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000408.Ar remote-path
409.Op Ar local-path
410.Xc
Damien Miller33804262001-02-04 23:20:18 +1100411Retrieve the
Damien Millerd7686fd2001-02-10 00:40:03 +1100412.Ar remote-path
Damien Miller33804262001-02-04 23:20:18 +1100413and store it on the local machine.
414If the local
Ben Lindstrom24643222001-06-25 05:08:11 +0000415path name is not specified, it is given the same name it has on the
Damien Miller50677922003-05-23 18:44:04 +1000416remote machine.
Darren Tucker16e254d2004-12-06 22:46:45 +1100417.Ar remote-path
418may contain
kn@openbsd.orgddf1b792018-07-23 19:02:49 +0000419.Xr glob 7
Darren Tucker16e254d2004-12-06 22:46:45 +1100420characters and may match multiple files.
421If it does and
422.Ar local-path
423is specified, then
424.Ar local-path
425must specify a directory.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100426.Pp
Damien Miller0d032412013-07-25 11:56:52 +1000427If the
428.Fl a
429flag is specified, then attempt to resume partial transfers of existing files.
430Note that resumption assumes that any partial copy of the local file matches
431the remote copy.
Damien Millereec84062013-08-21 02:39:39 +1000432If the remote file contents differ from the partial local copy then the
433resultant file is likely to be corrupt.
Damien Miller0d032412013-07-25 11:56:52 +1000434.Pp
Damien Millerf29238e2013-10-17 11:48:52 +1100435If the
436.Fl f
437flag is specified, then
438.Xr fsync 2
Damien Miller1edcbf62013-10-18 10:17:17 +1100439will be called after the file transfer has completed to flush the file
Damien Millerf29238e2013-10-17 11:48:52 +1100440to disk.
441.Pp
jmc@openbsd.org5f68ab42019-06-19 20:12:44 +0000442If the
Darren Tucker1b0dd172009-10-07 08:37:48 +1100443.Fl p
jmc@openbsd.org5f68ab42019-06-19 20:12:44 +0000444.\" undocumented redundant alias
445.\" or
446.\" .Fl P
Darren Tucker16e254d2004-12-06 22:46:45 +1100447flag is specified, then full file permissions and access times are
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000448copied too.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100449.Pp
450If the
jmc@openbsd.org5f68ab42019-06-19 20:12:44 +0000451.Fl R
452.\" undocumented redundant alias
453.\" or
454.\" .Fl r
Darren Tucker1b0dd172009-10-07 08:37:48 +1100455flag is specified then directories will be copied recursively.
456Note that
457.Nm
458does not follow symbolic links when performing recursive transfers.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000459.It Ic help
460Display help text.
djm@openbsd.org@openbsd.orgfbe8e7a2017-11-03 03:46:52 +0000461.It Ic lcd Op Ar path
Darren Tucker1f203942003-10-15 15:50:42 +1000462Change local directory to
463.Ar path .
djm@openbsd.org@openbsd.orgfbe8e7a2017-11-03 03:46:52 +0000464If
465.Ar path
466is not specified, then change directory to the local user's home directory.
Damien Millerd7686fd2001-02-10 00:40:03 +1100467.It Ic lls Op Ar ls-options Op Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000468Display local directory listing of either
Damien Miller33804262001-02-04 23:20:18 +1100469.Ar path
470or current directory if
471.Ar path
Damien Millerd7686fd2001-02-10 00:40:03 +1100472is not specified.
Darren Tucker16e254d2004-12-06 22:46:45 +1100473.Ar ls-options
474may contain any flags supported by the local system's
475.Xr ls 1
476command.
477.Ar path
478may contain
kn@openbsd.orgddf1b792018-07-23 19:02:49 +0000479.Xr glob 7
Darren Tucker16e254d2004-12-06 22:46:45 +1100480characters and may match multiple files.
Damien Millerd7686fd2001-02-10 00:40:03 +1100481.It Ic lmkdir Ar path
Damien Miller33804262001-02-04 23:20:18 +1100482Create local directory specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100483.Ar path .
Darren Tuckeraf1f9092010-12-05 09:02:47 +1100484.It Xo Ic ln
485.Op Fl s
486.Ar oldpath
487.Ar newpath
488.Xc
489Create a link from
Damien Miller058316f2001-03-08 10:08:49 +1100490.Ar oldpath
491to
492.Ar newpath .
Darren Tuckeraf1f9092010-12-05 09:02:47 +1100493If the
494.Fl s
495flag is specified the created link is a symbolic link, otherwise it is
496a hard link.
Damien Millerd7686fd2001-02-10 00:40:03 +1100497.It Ic lpwd
498Print local working directory.
Damien Millere1a49812002-09-12 09:54:25 +1000499.It Xo Ic ls
Darren Tucker75fe6262010-01-15 11:42:51 +1100500.Op Fl 1afhlnrSt
Damien Millere1a49812002-09-12 09:54:25 +1000501.Op Ar path
502.Xc
Darren Tucker16e254d2004-12-06 22:46:45 +1100503Display a remote directory listing of either
Damien Miller33804262001-02-04 23:20:18 +1100504.Ar path
Darren Tucker16e254d2004-12-06 22:46:45 +1100505or the current directory if
Damien Miller33804262001-02-04 23:20:18 +1100506.Ar path
Damien Miller50677922003-05-23 18:44:04 +1000507is not specified.
Darren Tucker16e254d2004-12-06 22:46:45 +1100508.Ar path
509may contain
kn@openbsd.orgddf1b792018-07-23 19:02:49 +0000510.Xr glob 7
Darren Tucker16e254d2004-12-06 22:46:45 +1100511characters and may match multiple files.
Darren Tucker15ca6e82004-06-22 13:08:21 +1000512.Pp
Darren Tucker16e254d2004-12-06 22:46:45 +1100513The following flags are recognized and alter the behaviour of
Darren Tucker15ca6e82004-06-22 13:08:21 +1000514.Ic ls
Darren Tucker16e254d2004-12-06 22:46:45 +1100515accordingly:
516.Bl -tag -width Ds
517.It Fl 1
518Produce single columnar output.
519.It Fl a
520List files beginning with a dot
521.Pq Sq \&. .
522.It Fl f
523Do not sort the listing.
524The default sort order is lexicographical.
Darren Tucker2901e2d2010-01-13 22:44:06 +1100525.It Fl h
526When used with a long format option, use unit suffixes: Byte, Kilobyte,
527Megabyte, Gigabyte, Terabyte, Petabyte, and Exabyte in order to reduce
528the number of digits to four or fewer using powers of 2 for sizes (K=1024,
529M=1048576, etc.).
Darren Tucker75fe6262010-01-15 11:42:51 +1100530.It Fl l
531Display additional details including permissions
532and ownership information.
Darren Tucker16e254d2004-12-06 22:46:45 +1100533.It Fl n
534Produce a long listing with user and group information presented
535numerically.
536.It Fl r
537Reverse the sort order of the listing.
538.It Fl S
539Sort the listing by file size.
540.It Fl t
541Sort the listing by last modification time.
542.El
Damien Millerd7686fd2001-02-10 00:40:03 +1100543.It Ic lumask Ar umask
Ben Lindstrom24643222001-06-25 05:08:11 +0000544Set local umask to
Damien Millerd7686fd2001-02-10 00:40:03 +1100545.Ar umask .
546.It Ic mkdir Ar path
547Create remote directory specified by
548.Ar path .
Damien Miller62d57f62003-01-10 21:43:24 +1100549.It Ic progress
550Toggle display of progress meter.
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000551.It Xo Ic put
jmc@openbsd.org5f68ab42019-06-19 20:12:44 +0000552.Op Fl afpR
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000553.Ar local-path
Ben Lindstromd5767812002-12-23 02:23:37 +0000554.Op Ar remote-path
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000555.Xc
Damien Miller33804262001-02-04 23:20:18 +1100556Upload
Damien Millerd7686fd2001-02-10 00:40:03 +1100557.Ar local-path
Damien Miller50677922003-05-23 18:44:04 +1000558and store it on the remote machine.
559If the remote path name is not specified, it is given the same name it has
560on the local machine.
Darren Tucker16e254d2004-12-06 22:46:45 +1100561.Ar local-path
562may contain
kn@openbsd.orgddf1b792018-07-23 19:02:49 +0000563.Xr glob 7
Darren Tucker16e254d2004-12-06 22:46:45 +1100564characters and may match multiple files.
565If it does and
566.Ar remote-path
567is specified, then
568.Ar remote-path
569must specify a directory.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100570.Pp
Damien Millerf29238e2013-10-17 11:48:52 +1100571If the
Damien Miller798a0252014-05-15 13:47:37 +1000572.Fl a
Damien Millerd875ff72014-05-15 13:47:15 +1000573flag is specified, then attempt to resume partial
574transfers of existing files.
Damien Miller798a0252014-05-15 13:47:37 +1000575Note that resumption assumes that any partial copy of the remote file
Damien Millerd875ff72014-05-15 13:47:15 +1000576matches the local copy.
577If the local file contents differ from the remote local copy then
578the resultant file is likely to be corrupt.
579.Pp
580If the
Damien Millerf29238e2013-10-17 11:48:52 +1100581.Fl f
582flag is specified, then a request will be sent to the server to call
583.Xr fsync 2
584after the file has been transferred.
585Note that this is only supported by servers that implement
586the "fsync@openssh.com" extension.
587.Pp
jmc@openbsd.org5f68ab42019-06-19 20:12:44 +0000588If the
Darren Tucker1b0dd172009-10-07 08:37:48 +1100589.Fl p
jmc@openbsd.org5f68ab42019-06-19 20:12:44 +0000590.\" undocumented redundant alias
591.\" or
592.\" .Fl P
Darren Tucker1b0dd172009-10-07 08:37:48 +1100593flag is specified, then full file permissions and access times are
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000594copied too.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100595.Pp
596If the
jmc@openbsd.org5f68ab42019-06-19 20:12:44 +0000597.Fl R
598.\" undocumented redundant alias
599.\" or
600.\" .Fl r
Darren Tucker1b0dd172009-10-07 08:37:48 +1100601flag is specified then directories will be copied recursively.
602Note that
603.Nm
604does not follow symbolic links when performing recursive transfers.
Damien Millerd7686fd2001-02-10 00:40:03 +1100605.It Ic pwd
606Display remote working directory.
Damien Millerd7686fd2001-02-10 00:40:03 +1100607.It Ic quit
Damien Miller50677922003-05-23 18:44:04 +1000608Quit
609.Nm sftp .
Damien Miller0d032412013-07-25 11:56:52 +1000610.It Xo Ic reget
jmc@openbsd.org5f68ab42019-06-19 20:12:44 +0000611.Op Fl fpR
Damien Miller0d032412013-07-25 11:56:52 +1000612.Ar remote-path
613.Op Ar local-path
614.Xc
615Resume download of
616.Ar remote-path .
617Equivalent to
618.Ic get
619with the
620.Fl a
621flag set.
Damien Millerd875ff72014-05-15 13:47:15 +1000622.It Xo Ic reput
jmc@openbsd.org5f68ab42019-06-19 20:12:44 +0000623.Op Fl fpR
624.Ar local-path
625.Op Ar remote-path
Damien Millerd875ff72014-05-15 13:47:15 +1000626.Xc
627Resume upload of
jmc@openbsd.org5f68ab42019-06-19 20:12:44 +0000628.Ar local-path .
Damien Millerd875ff72014-05-15 13:47:15 +1000629Equivalent to
630.Ic put
Damien Miller798a0252014-05-15 13:47:37 +1000631with the
Damien Millerd875ff72014-05-15 13:47:15 +1000632.Fl a
633flag set.
Damien Millerd7686fd2001-02-10 00:40:03 +1100634.It Ic rename Ar oldpath Ar newpath
Damien Miller33804262001-02-04 23:20:18 +1100635Rename remote file from
636.Ar oldpath
637to
Damien Millerd7686fd2001-02-10 00:40:03 +1100638.Ar newpath .
Damien Millerd7686fd2001-02-10 00:40:03 +1100639.It Ic rm Ar path
Damien Miller33804262001-02-04 23:20:18 +1100640Delete remote file specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100641.Ar path .
Darren Tucker1f203942003-10-15 15:50:42 +1000642.It Ic rmdir Ar path
643Remove remote directory specified by
644.Ar path .
Damien Miller058316f2001-03-08 10:08:49 +1100645.It Ic symlink Ar oldpath Ar newpath
Ben Lindstrom24643222001-06-25 05:08:11 +0000646Create a symbolic link from
Damien Miller058316f2001-03-08 10:08:49 +1100647.Ar oldpath
648to
649.Ar newpath .
Damien Miller63421802003-01-08 14:05:23 +1100650.It Ic version
651Display the
652.Nm
653protocol version.
Damien Miller62fd18a2009-01-28 16:14:09 +1100654.It Ic \&! Ns Ar command
Ben Lindstrom24643222001-06-25 05:08:11 +0000655Execute
Damien Miller33804262001-02-04 23:20:18 +1100656.Ar command
Damien Millerd7686fd2001-02-10 00:40:03 +1100657in local shell.
Damien Millerc2b98272003-09-03 12:13:30 +1000658.It Ic \&!
Damien Millerd7686fd2001-02-10 00:40:03 +1100659Escape to local shell.
Damien Millerc2b98272003-09-03 12:13:30 +1000660.It Ic \&?
Damien Millerd7686fd2001-02-10 00:40:03 +1100661Synonym for help.
662.El
Damien Miller33804262001-02-04 23:20:18 +1100663.Sh SEE ALSO
Darren Tucker1f203942003-10-15 15:50:42 +1000664.Xr ftp 1 ,
Darren Tucker16e254d2004-12-06 22:46:45 +1100665.Xr ls 1 ,
Ben Lindstrom160ec622001-04-22 17:17:46 +0000666.Xr scp 1 ,
Damien Miller33804262001-02-04 23:20:18 +1100667.Xr ssh 1 ,
668.Xr ssh-add 1 ,
669.Xr ssh-keygen 1 ,
Ben Lindstrom3072aae2002-06-21 01:02:39 +0000670.Xr ssh_config 5 ,
jmc@openbsd.orge2127ab2018-07-23 19:53:55 +0000671.Xr glob 7 ,
Ben Lindstrom160ec622001-04-22 17:17:46 +0000672.Xr sftp-server 8 ,
673.Xr sshd 8
674.Rs
Ben Lindstrom90fd0602001-06-25 04:45:33 +0000675.%A T. Ylonen
676.%A S. Lehtinen
Ben Lindstrom160ec622001-04-22 17:17:46 +0000677.%T "SSH File Transfer Protocol"
678.%N draft-ietf-secsh-filexfer-00.txt
679.%D January 2001
680.%O work in progress material
681.Re