blob: 259095885a7880511633c669edae0fbc32774ed0 [file] [log] [blame]
jmc@openbsd.orgfd8eb132019-01-22 06:58:31 +00001.\" $OpenBSD: sftp.1,v 1.125 2019/01/22 06:58:31 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.orgfd8eb132019-01-22 06:58:31 +000025.Dd $Mdocdate: January 22 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
244.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
Damien Millerf29238e2013-10-17 11:48:52 +1100407.Op Fl afPpr
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
Darren Tuckerb3b40a82009-10-07 08:39:09 +1100442If either the
Darren Tucker05016b22009-10-07 08:38:23 +1100443.Fl P
Darren Tucker1b0dd172009-10-07 08:37:48 +1100444or
445.Fl p
Darren Tucker16e254d2004-12-06 22:46:45 +1100446flag is specified, then full file permissions and access times are
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000447copied too.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100448.Pp
449If the
450.Fl r
451flag is specified then directories will be copied recursively.
452Note that
453.Nm
454does not follow symbolic links when performing recursive transfers.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000455.It Ic help
456Display help text.
djm@openbsd.org@openbsd.orgfbe8e7a2017-11-03 03:46:52 +0000457.It Ic lcd Op Ar path
Darren Tucker1f203942003-10-15 15:50:42 +1000458Change local directory to
459.Ar path .
djm@openbsd.org@openbsd.orgfbe8e7a2017-11-03 03:46:52 +0000460If
461.Ar path
462is not specified, then change directory to the local user's home directory.
Damien Millerd7686fd2001-02-10 00:40:03 +1100463.It Ic lls Op Ar ls-options Op Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000464Display local directory listing of either
Damien Miller33804262001-02-04 23:20:18 +1100465.Ar path
466or current directory if
467.Ar path
Damien Millerd7686fd2001-02-10 00:40:03 +1100468is not specified.
Darren Tucker16e254d2004-12-06 22:46:45 +1100469.Ar ls-options
470may contain any flags supported by the local system's
471.Xr ls 1
472command.
473.Ar path
474may contain
kn@openbsd.orgddf1b792018-07-23 19:02:49 +0000475.Xr glob 7
Darren Tucker16e254d2004-12-06 22:46:45 +1100476characters and may match multiple files.
Damien Millerd7686fd2001-02-10 00:40:03 +1100477.It Ic lmkdir Ar path
Damien Miller33804262001-02-04 23:20:18 +1100478Create local directory specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100479.Ar path .
Darren Tuckeraf1f9092010-12-05 09:02:47 +1100480.It Xo Ic ln
481.Op Fl s
482.Ar oldpath
483.Ar newpath
484.Xc
485Create a link from
Damien Miller058316f2001-03-08 10:08:49 +1100486.Ar oldpath
487to
488.Ar newpath .
Darren Tuckeraf1f9092010-12-05 09:02:47 +1100489If the
490.Fl s
491flag is specified the created link is a symbolic link, otherwise it is
492a hard link.
Damien Millerd7686fd2001-02-10 00:40:03 +1100493.It Ic lpwd
494Print local working directory.
Damien Millere1a49812002-09-12 09:54:25 +1000495.It Xo Ic ls
Darren Tucker75fe6262010-01-15 11:42:51 +1100496.Op Fl 1afhlnrSt
Damien Millere1a49812002-09-12 09:54:25 +1000497.Op Ar path
498.Xc
Darren Tucker16e254d2004-12-06 22:46:45 +1100499Display a remote directory listing of either
Damien Miller33804262001-02-04 23:20:18 +1100500.Ar path
Darren Tucker16e254d2004-12-06 22:46:45 +1100501or the current directory if
Damien Miller33804262001-02-04 23:20:18 +1100502.Ar path
Damien Miller50677922003-05-23 18:44:04 +1000503is not specified.
Darren Tucker16e254d2004-12-06 22:46:45 +1100504.Ar path
505may contain
kn@openbsd.orgddf1b792018-07-23 19:02:49 +0000506.Xr glob 7
Darren Tucker16e254d2004-12-06 22:46:45 +1100507characters and may match multiple files.
Darren Tucker15ca6e82004-06-22 13:08:21 +1000508.Pp
Darren Tucker16e254d2004-12-06 22:46:45 +1100509The following flags are recognized and alter the behaviour of
Darren Tucker15ca6e82004-06-22 13:08:21 +1000510.Ic ls
Darren Tucker16e254d2004-12-06 22:46:45 +1100511accordingly:
512.Bl -tag -width Ds
513.It Fl 1
514Produce single columnar output.
515.It Fl a
516List files beginning with a dot
517.Pq Sq \&. .
518.It Fl f
519Do not sort the listing.
520The default sort order is lexicographical.
Darren Tucker2901e2d2010-01-13 22:44:06 +1100521.It Fl h
522When used with a long format option, use unit suffixes: Byte, Kilobyte,
523Megabyte, Gigabyte, Terabyte, Petabyte, and Exabyte in order to reduce
524the number of digits to four or fewer using powers of 2 for sizes (K=1024,
525M=1048576, etc.).
Darren Tucker75fe6262010-01-15 11:42:51 +1100526.It Fl l
527Display additional details including permissions
528and ownership information.
Darren Tucker16e254d2004-12-06 22:46:45 +1100529.It Fl n
530Produce a long listing with user and group information presented
531numerically.
532.It Fl r
533Reverse the sort order of the listing.
534.It Fl S
535Sort the listing by file size.
536.It Fl t
537Sort the listing by last modification time.
538.El
Damien Millerd7686fd2001-02-10 00:40:03 +1100539.It Ic lumask Ar umask
Ben Lindstrom24643222001-06-25 05:08:11 +0000540Set local umask to
Damien Millerd7686fd2001-02-10 00:40:03 +1100541.Ar umask .
542.It Ic mkdir Ar path
543Create remote directory specified by
544.Ar path .
Damien Miller62d57f62003-01-10 21:43:24 +1100545.It Ic progress
546Toggle display of progress meter.
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000547.It Xo Ic put
Damien Millerd875ff72014-05-15 13:47:15 +1000548.Op Fl afPpr
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000549.Ar local-path
Ben Lindstromd5767812002-12-23 02:23:37 +0000550.Op Ar remote-path
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000551.Xc
Damien Miller33804262001-02-04 23:20:18 +1100552Upload
Damien Millerd7686fd2001-02-10 00:40:03 +1100553.Ar local-path
Damien Miller50677922003-05-23 18:44:04 +1000554and store it on the remote machine.
555If the remote path name is not specified, it is given the same name it has
556on the local machine.
Darren Tucker16e254d2004-12-06 22:46:45 +1100557.Ar local-path
558may contain
kn@openbsd.orgddf1b792018-07-23 19:02:49 +0000559.Xr glob 7
Darren Tucker16e254d2004-12-06 22:46:45 +1100560characters and may match multiple files.
561If it does and
562.Ar remote-path
563is specified, then
564.Ar remote-path
565must specify a directory.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100566.Pp
Damien Millerf29238e2013-10-17 11:48:52 +1100567If the
Damien Miller798a0252014-05-15 13:47:37 +1000568.Fl a
Damien Millerd875ff72014-05-15 13:47:15 +1000569flag is specified, then attempt to resume partial
570transfers of existing files.
Damien Miller798a0252014-05-15 13:47:37 +1000571Note that resumption assumes that any partial copy of the remote file
Damien Millerd875ff72014-05-15 13:47:15 +1000572matches the local copy.
573If the local file contents differ from the remote local copy then
574the resultant file is likely to be corrupt.
575.Pp
576If the
Damien Millerf29238e2013-10-17 11:48:52 +1100577.Fl f
578flag is specified, then a request will be sent to the server to call
579.Xr fsync 2
580after the file has been transferred.
581Note that this is only supported by servers that implement
582the "fsync@openssh.com" extension.
583.Pp
Darren Tuckerddccfb42011-08-07 23:12:26 +1000584If either the
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000585.Fl P
Darren Tucker1b0dd172009-10-07 08:37:48 +1100586or
587.Fl p
588flag is specified, then full file permissions and access times are
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000589copied too.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100590.Pp
591If the
592.Fl r
593flag is specified then directories will be copied recursively.
594Note that
595.Nm
596does not follow symbolic links when performing recursive transfers.
Damien Millerd7686fd2001-02-10 00:40:03 +1100597.It Ic pwd
598Display remote working directory.
Damien Millerd7686fd2001-02-10 00:40:03 +1100599.It Ic quit
Damien Miller50677922003-05-23 18:44:04 +1000600Quit
601.Nm sftp .
Damien Miller0d032412013-07-25 11:56:52 +1000602.It Xo Ic reget
603.Op Fl Ppr
604.Ar remote-path
605.Op Ar local-path
606.Xc
607Resume download of
608.Ar remote-path .
609Equivalent to
610.Ic get
611with the
612.Fl a
613flag set.
Damien Millerd875ff72014-05-15 13:47:15 +1000614.It Xo Ic reput
615.Op Fl Ppr
616.Op Ar local-path
617.Ar remote-path
618.Xc
619Resume upload of
620.Op Ar local-path .
621Equivalent to
622.Ic put
Damien Miller798a0252014-05-15 13:47:37 +1000623with the
Damien Millerd875ff72014-05-15 13:47:15 +1000624.Fl a
625flag set.
Damien Millerd7686fd2001-02-10 00:40:03 +1100626.It Ic rename Ar oldpath Ar newpath
Damien Miller33804262001-02-04 23:20:18 +1100627Rename remote file from
628.Ar oldpath
629to
Damien Millerd7686fd2001-02-10 00:40:03 +1100630.Ar newpath .
Damien Millerd7686fd2001-02-10 00:40:03 +1100631.It Ic rm Ar path
Damien Miller33804262001-02-04 23:20:18 +1100632Delete remote file specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100633.Ar path .
Darren Tucker1f203942003-10-15 15:50:42 +1000634.It Ic rmdir Ar path
635Remove remote directory specified by
636.Ar path .
Damien Miller058316f2001-03-08 10:08:49 +1100637.It Ic symlink Ar oldpath Ar newpath
Ben Lindstrom24643222001-06-25 05:08:11 +0000638Create a symbolic link from
Damien Miller058316f2001-03-08 10:08:49 +1100639.Ar oldpath
640to
641.Ar newpath .
Damien Miller63421802003-01-08 14:05:23 +1100642.It Ic version
643Display the
644.Nm
645protocol version.
Damien Miller62fd18a2009-01-28 16:14:09 +1100646.It Ic \&! Ns Ar command
Ben Lindstrom24643222001-06-25 05:08:11 +0000647Execute
Damien Miller33804262001-02-04 23:20:18 +1100648.Ar command
Damien Millerd7686fd2001-02-10 00:40:03 +1100649in local shell.
Damien Millerc2b98272003-09-03 12:13:30 +1000650.It Ic \&!
Damien Millerd7686fd2001-02-10 00:40:03 +1100651Escape to local shell.
Damien Millerc2b98272003-09-03 12:13:30 +1000652.It Ic \&?
Damien Millerd7686fd2001-02-10 00:40:03 +1100653Synonym for help.
654.El
Damien Miller33804262001-02-04 23:20:18 +1100655.Sh SEE ALSO
Darren Tucker1f203942003-10-15 15:50:42 +1000656.Xr ftp 1 ,
Darren Tucker16e254d2004-12-06 22:46:45 +1100657.Xr ls 1 ,
Ben Lindstrom160ec622001-04-22 17:17:46 +0000658.Xr scp 1 ,
Damien Miller33804262001-02-04 23:20:18 +1100659.Xr ssh 1 ,
660.Xr ssh-add 1 ,
661.Xr ssh-keygen 1 ,
Ben Lindstrom3072aae2002-06-21 01:02:39 +0000662.Xr ssh_config 5 ,
jmc@openbsd.orge2127ab2018-07-23 19:53:55 +0000663.Xr glob 7 ,
Ben Lindstrom160ec622001-04-22 17:17:46 +0000664.Xr sftp-server 8 ,
665.Xr sshd 8
666.Rs
Ben Lindstrom90fd0602001-06-25 04:45:33 +0000667.%A T. Ylonen
668.%A S. Lehtinen
Ben Lindstrom160ec622001-04-22 17:17:46 +0000669.%T "SSH File Transfer Protocol"
670.%N draft-ietf-secsh-filexfer-00.txt
671.%D January 2001
672.%O work in progress material
673.Re