blob: 49f7febf157f6536bb6b76405ddc117eb27d9f05 [file] [log] [blame]
millert@openbsd.org887669e2017-10-21 23:06:24 +00001.\" $OpenBSD: sftp.1,v 1.111 2017/10/21 23:06:24 millert 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.\"
millert@openbsd.org887669e2017-10-21 23:06:24 +000025.Dd $Mdocdate: October 21 2017 $
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
Damien Miller495dca32003-04-01 21:42:14 +100033.Bk -words
djm@openbsd.org3575f0b2017-05-02 08:54:19 +000034.Op Fl 46aCfpqrv
Damien Miller81b6e782002-02-08 22:06:03 +110035.Op Fl B Ar buffer_size
Darren Tucker1f203942003-10-15 15:50:42 +100036.Op Fl b Ar batchfile
Darren Tucker46bbbe32009-10-07 08:21:48 +110037.Op Fl c Ar cipher
Darren Tucker282b4022009-10-07 08:23:06 +110038.Op Fl D Ar sftp_server_path
Damien Miller81b6e782002-02-08 22:06:03 +110039.Op Fl F Ar ssh_config
Darren Tuckerc07138e2009-10-07 08:23:44 +110040.Op Fl i Ar identity_file
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
61.Oo Ar user Ns @ Oc Ns Ar host Ns Oo : Ns Ar path Oc
62or as an sftp URI in the form
63.No sftp:// Ns Oo Ar user Ns @ Oc Ns Ar host Ns
64.Oo : Ns Ar port Oc Ns Oo / Ns Ar path Oc .
65.Pp
66If the
67.Ar destination
68includes a
69.Ar path
70and it is not a directory,
71.Nm
72will retrieve files automatically if a non-interactive
Ben Lindstromaafff9c2001-05-06 03:01:02 +000073authentication method is used; otherwise it will do so after
74successful interactive authentication.
Ben Lindstrom63667f62001-04-13 00:00:14 +000075.Pp
millert@openbsd.org887669e2017-10-21 23:06:24 +000076If no
77.Ar path
78is specified, or if the
79.Ar path
80is a directory,
Darren Tucker16e254d2004-12-06 22:46:45 +110081.Nm
millert@openbsd.org887669e2017-10-21 23:06:24 +000082will log in to the specified
83.Ar host
84and enter interactive command mode, changing to the remote directory
85if one was specified.
86An optional trailing slash can be used to force the
87.Ar path
88to be interpreted as a directory.
Ben Lindstrom63667f62001-04-13 00:00:14 +000089.Pp
millert@openbsd.org887669e2017-10-21 23:06:24 +000090Since the destination formats use colon characters to delimit host
91names from path names or port numbers, IPv6 addresses must be
92enclosed in square brackets to avoid ambiguity.
Damien Miller58a77e22011-05-15 08:36:29 +100093.Pp
Damien Miller33804262001-02-04 23:20:18 +110094The options are as follows:
95.Bl -tag -width Ds
Darren Tucker46bbbe32009-10-07 08:21:48 +110096.It Fl 4
97Forces
98.Nm
99to use IPv4 addresses only.
100.It Fl 6
101Forces
102.Nm
103to use IPv6 addresses only.
Damien Millerc6895c52013-08-21 02:40:21 +1000104.It Fl a
Damien Miller798a0252014-05-15 13:47:37 +1000105Attempt to continue interrupted transfers rather than overwriting
Damien Millerd875ff72014-05-15 13:47:15 +1000106existing partial or complete copies of files.
Damien Miller798a0252014-05-15 13:47:37 +1000107If the partial contents differ from those being transferred,
Damien Millerd875ff72014-05-15 13:47:15 +1000108then the resultant file is likely to be corrupt.
Darren Tucker1f203942003-10-15 15:50:42 +1000109.It Fl B Ar buffer_size
110Specify the size of the buffer that
111.Nm
112uses when transferring files.
113Larger buffers require fewer round trips at the cost of higher
114memory consumption.
115The default is 32768 bytes.
Ben Lindstrom562c26b2001-03-07 01:26:48 +0000116.It Fl b Ar batchfile
117Batch mode reads a series of commands from an input
Ben Lindstrom283cb822001-03-09 00:09:02 +0000118.Ar batchfile
Ben Lindstrom562c26b2001-03-07 01:26:48 +0000119instead of
Ben Lindstrom283cb822001-03-09 00:09:02 +0000120.Em stdin .
121Since it lacks user interaction it should be used in conjunction with
millert@openbsd.org887669e2017-10-21 23:06:24 +0000122non-interactive authentication to obviate the need to enter a password
123at connection time (see
124.Xr sshd 8
125and
126.Xr ssh-keygen 1
127for details).
Damien Miller44f75c12004-01-21 10:58:47 +1100128A
Damien Miller86a39682004-01-21 11:00:04 +1100129.Ar batchfile
130of
131.Sq \-
Damien Miller44f75c12004-01-21 10:58:47 +1100132may be used to indicate standard input.
Ben Lindstrom283cb822001-03-09 00:09:02 +0000133.Nm
Ben Lindstrom24643222001-06-25 05:08:11 +0000134will abort if any of the following
135commands fail:
Damien Millerd875ff72014-05-15 13:47:15 +1000136.Ic get , put , reget , reput, rename , ln ,
Damien Miller495dca32003-04-01 21:42:14 +1000137.Ic rm , mkdir , chdir , ls ,
Damien Miller64058cb2008-05-19 14:54:25 +1000138.Ic lchdir , chmod , chown ,
Darren Tuckeraf1f9092010-12-05 09:02:47 +1100139.Ic chgrp , lpwd , df , symlink ,
Ben Lindstrom562c26b2001-03-07 01:26:48 +0000140and
Ben Lindstrom283cb822001-03-09 00:09:02 +0000141.Ic lmkdir .
Damien Miller495dca32003-04-01 21:42:14 +1000142Termination on error can be suppressed on a command by command basis by
143prefixing the command with a
Damien Miller86a39682004-01-21 11:00:04 +1100144.Sq \-
Damien Miller50677922003-05-23 18:44:04 +1000145character (for example,
146.Ic -rm /tmp/blah* ) .
Darren Tucker1f203942003-10-15 15:50:42 +1000147.It Fl C
148Enables compression (via ssh's
149.Fl C
150flag).
Darren Tuckeradba1ba2009-10-07 08:22:20 +1100151.It Fl c Ar cipher
152Selects the cipher to use for encrypting the data transfers.
153This option is directly passed to
154.Xr ssh 1 .
Darren Tucker282b4022009-10-07 08:23:06 +1100155.It Fl D Ar sftp_server_path
156Connect directly to a local sftp server
157(rather than via
158.Xr ssh 1 ) .
159This option may be useful in debugging the client and server.
Darren Tucker1f203942003-10-15 15:50:42 +1000160.It Fl F Ar ssh_config
161Specifies an alternative
162per-user configuration file for
163.Xr ssh 1 .
164This option is directly passed to
165.Xr ssh 1 .
Damien Millerf29238e2013-10-17 11:48:52 +1100166.It Fl f
167Requests that files be flushed to disk immediately after transfer.
168When uploading files, this feature is only enabled if the server
169implements the "fsync@openssh.com" extension.
Darren Tucker46bbbe32009-10-07 08:21:48 +1100170.It Fl i Ar identity_file
171Selects the file from which the identity (private key) for public key
172authentication is read.
173This option is directly passed to
174.Xr ssh 1 .
Damien Miller65e42f82010-09-24 22:15:11 +1000175.It Fl l Ar limit
176Limits the used bandwidth, specified in Kbit/s.
Damien Miller33804262001-02-04 23:20:18 +1100177.It Fl o Ar ssh_option
Ben Lindstrom14c62eb2001-08-15 23:25:46 +0000178Can be used to pass options to
179.Nm ssh
Ben Lindstrom3072aae2002-06-21 01:02:39 +0000180in the format used in
181.Xr ssh_config 5 .
182This is useful for specifying options
Ben Lindstrom14c62eb2001-08-15 23:25:46 +0000183for which there is no separate
184.Nm sftp
Damien Miller50677922003-05-23 18:44:04 +1000185command-line flag.
186For example, to specify an alternate port use:
Ben Lindstrom6a337632001-09-18 05:47:32 +0000187.Ic sftp -oPort=24 .
Darren Tucker1f203942003-10-15 15:50:42 +1000188For full details of the options listed below, and their possible values, see
189.Xr ssh_config 5 .
190.Pp
191.Bl -tag -width Ds -offset indent -compact
192.It AddressFamily
193.It BatchMode
194.It BindAddress
Damien Millerc0049bd2013-10-23 16:29:59 +1100195.It CanonicalDomains
196.It CanonicalizeFallbackLocal
197.It CanonicalizeHostname
198.It CanonicalizeMaxDots
199.It CanonicalizePermittedCNAMEs
jmc@openbsd.orgc5f7c082015-09-25 18:19:54 +0000200.It CertificateFile
Darren Tucker1f203942003-10-15 15:50:42 +1000201.It ChallengeResponseAuthentication
202.It CheckHostIP
Darren Tucker1f203942003-10-15 15:50:42 +1000203.It Ciphers
Darren Tucker1f203942003-10-15 15:50:42 +1000204.It Compression
naddy@openbsd.org9a82e242017-05-03 21:49:18 +0000205.It ConnectionAttempts
Darren Tucker3d5cbb72004-05-03 09:13:15 +1000206.It ConnectTimeout
Damien Miller0e220db2004-06-15 10:34:08 +1000207.It ControlMaster
208.It ControlPath
Damien Millere5777722011-09-22 21:34:15 +1000209.It ControlPersist
Darren Tucker1f203942003-10-15 15:50:42 +1000210.It GlobalKnownHostsFile
211.It GSSAPIAuthentication
212.It GSSAPIDelegateCredentials
Damien Miller27e9c512005-03-02 12:04:16 +1100213.It HashKnownHosts
Darren Tucker1f203942003-10-15 15:50:42 +1000214.It Host
215.It HostbasedAuthentication
djm@openbsd.org46347ed2015-01-30 11:43:14 +0000216.It HostbasedKeyTypes
Darren Tucker1f203942003-10-15 15:50:42 +1000217.It HostKeyAlgorithms
218.It HostKeyAlias
219.It HostName
jmc@openbsd.org772e6ce2016-06-29 17:14:28 +0000220.It IdentitiesOnly
markus@openbsd.org75e21682016-05-04 14:32:26 +0000221.It IdentityAgent
Darren Tucker1f203942003-10-15 15:50:42 +1000222.It IdentityFile
Damien Miller0a184732010-11-20 15:21:03 +1100223.It IPQoS
Damien Millere5777722011-09-22 21:34:15 +1000224.It KbdInteractiveAuthentication
Darren Tucker636ca902004-11-05 20:22:00 +1100225.It KbdInteractiveDevices
Damien Miller2beb32f2010-09-24 22:16:03 +1000226.It KexAlgorithms
Darren Tucker1f203942003-10-15 15:50:42 +1000227.It LogLevel
228.It MACs
229.It NoHostAuthenticationForLocalhost
230.It NumberOfPasswordPrompts
231.It PasswordAuthentication
Damien Miller7ea845e2010-02-12 09:21:02 +1100232.It PKCS11Provider
Darren Tucker1f203942003-10-15 15:50:42 +1000233.It Port
234.It PreferredAuthentications
Darren Tucker1f203942003-10-15 15:50:42 +1000235.It ProxyCommand
jmc@openbsd.orge4eb7d92016-07-16 06:57:55 +0000236.It ProxyJump
jmc@openbsd.org42b690b2017-05-02 14:06:37 +0000237.It PubkeyAcceptedKeyTypes
Darren Tucker1f203942003-10-15 15:50:42 +1000238.It PubkeyAuthentication
Darren Tucker62388b22006-01-20 11:31:47 +1100239.It RekeyLimit
Darren Tucker7a6c0662004-05-02 22:14:03 +1000240.It SendEnv
Damien Miller509b0102003-12-17 16:33:10 +1100241.It ServerAliveInterval
242.It ServerAliveCountMax
Darren Tucker1f203942003-10-15 15:50:42 +1000243.It StrictHostKeyChecking
Damien Miller12c150e2003-12-17 16:31:10 +1100244.It TCPKeepAlive
djm@openbsd.org1d1092b2015-01-26 12:16:36 +0000245.It UpdateHostKeys
Darren Tucker1f203942003-10-15 15:50:42 +1000246.It UsePrivilegedPort
247.It User
248.It UserKnownHostsFile
249.It VerifyHostKeyDNS
Darren Tucker1f203942003-10-15 15:50:42 +1000250.El
Darren Tucker282b4022009-10-07 08:23:06 +1100251.It Fl P Ar port
252Specifies the port to connect to on the remote host.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100253.It Fl p
254Preserves modification times, access times, and modes from the
255original files transferred.
Darren Tucker46bbbe32009-10-07 08:21:48 +1100256.It Fl q
257Quiet mode: disables the progress meter as well as warning and
258diagnostic messages from
259.Xr ssh 1 .
Damien Miller16a13332002-02-13 14:03:56 +1100260.It Fl R Ar num_requests
Damien Miller50677922003-05-23 18:44:04 +1000261Specify how many requests may be outstanding at any one time.
262Increasing this may slightly improve file transfer speed
263but will increase memory usage.
Damien Miller94717b02008-07-16 21:17:23 +1000264The default is 64 outstanding requests.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100265.It Fl r
266Recursively copy entire directories when uploading and downloading.
267Note that
268.Nm
269does not follow symbolic links encountered in the tree traversal.
Ben Lindstrom6a337632001-09-18 05:47:32 +0000270.It Fl S Ar program
271Name of the
272.Ar program
273to use for the encrypted connection.
274The program must understand
275.Xr ssh 1
276options.
Darren Tucker1f203942003-10-15 15:50:42 +1000277.It Fl s Ar subsystem | sftp_server
278Specifies the SSH2 subsystem or the path for an sftp server
279on the remote host.
jmc@openbsd.org2b6f7992017-05-03 06:32:02 +0000280A path is useful when the remote
Darren Tucker1f203942003-10-15 15:50:42 +1000281.Xr sshd 8
282does not have an sftp subsystem configured.
283.It Fl v
284Raise logging level.
285This option is also passed to ssh.
Damien Miller33804262001-02-04 23:20:18 +1100286.El
287.Sh INTERACTIVE COMMANDS
Damien Millerd7686fd2001-02-10 00:40:03 +1100288Once in interactive mode,
289.Nm
Ben Lindstrom24643222001-06-25 05:08:11 +0000290understands a set of commands similar to those of
Damien Miller33804262001-02-04 23:20:18 +1100291.Xr ftp 1 .
Darren Tucker16e254d2004-12-06 22:46:45 +1100292Commands are case insensitive.
293Pathnames that contain spaces must be enclosed in quotes.
294Any special characters contained within pathnames that are recognized by
295.Xr glob 3
296must be escaped with backslashes
297.Pq Sq \e .
298.Bl -tag -width Ds
Ben Lindstrom59e12492001-08-15 23:22:56 +0000299.It Ic bye
Damien Miller50677922003-05-23 18:44:04 +1000300Quit
301.Nm sftp .
Damien Millerd7686fd2001-02-10 00:40:03 +1100302.It Ic cd Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000303Change remote directory to
Damien Millerd7686fd2001-02-10 00:40:03 +1100304.Ar path .
Damien Millerd7686fd2001-02-10 00:40:03 +1100305.It Ic chgrp Ar grp Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000306Change group of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100307.Ar path
308to
Damien Miller33804262001-02-04 23:20:18 +1100309.Ar grp .
Darren Tucker16e254d2004-12-06 22:46:45 +1100310.Ar path
311may contain
312.Xr glob 3
313characters and may match multiple files.
Damien Miller33804262001-02-04 23:20:18 +1100314.Ar grp
Damien Millerd7686fd2001-02-10 00:40:03 +1100315must be a numeric GID.
316.It Ic chmod Ar mode Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000317Change permissions of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100318.Ar path
319to
320.Ar mode .
Darren Tucker16e254d2004-12-06 22:46:45 +1100321.Ar path
322may contain
323.Xr glob 3
324characters and may match multiple files.
Damien Millerd7686fd2001-02-10 00:40:03 +1100325.It Ic chown Ar own Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000326Change owner of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100327.Ar path
328to
Damien Miller33804262001-02-04 23:20:18 +1100329.Ar own .
Darren Tucker16e254d2004-12-06 22:46:45 +1100330.Ar path
331may contain
332.Xr glob 3
333characters and may match multiple files.
Damien Miller33804262001-02-04 23:20:18 +1100334.Ar own
335must be a numeric UID.
Damien Millerd671e5a2008-05-19 14:53:33 +1000336.It Xo Ic df
337.Op Fl hi
338.Op Ar path
339.Xc
340Display usage information for the filesystem holding the current directory
341(or
342.Ar path
343if specified).
344If the
345.Fl h
346flag is specified, the capacity information will be displayed using
347"human-readable" suffixes.
348The
349.Fl i
350flag requests display of inode information in addition to capacity information.
351This command is only supported on servers that implement the
352.Dq statvfs@openssh.com
353extension.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000354.It Ic exit
Damien Miller50677922003-05-23 18:44:04 +1000355Quit
356.Nm sftp .
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000357.It Xo Ic get
Damien Millerf29238e2013-10-17 11:48:52 +1100358.Op Fl afPpr
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000359.Ar remote-path
360.Op Ar local-path
361.Xc
Damien Miller33804262001-02-04 23:20:18 +1100362Retrieve the
Damien Millerd7686fd2001-02-10 00:40:03 +1100363.Ar remote-path
Damien Miller33804262001-02-04 23:20:18 +1100364and store it on the local machine.
365If the local
Ben Lindstrom24643222001-06-25 05:08:11 +0000366path name is not specified, it is given the same name it has on the
Damien Miller50677922003-05-23 18:44:04 +1000367remote machine.
Darren Tucker16e254d2004-12-06 22:46:45 +1100368.Ar remote-path
369may contain
370.Xr glob 3
371characters and may match multiple files.
372If it does and
373.Ar local-path
374is specified, then
375.Ar local-path
376must specify a directory.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100377.Pp
Damien Miller0d032412013-07-25 11:56:52 +1000378If the
379.Fl a
380flag is specified, then attempt to resume partial transfers of existing files.
381Note that resumption assumes that any partial copy of the local file matches
382the remote copy.
Damien Millereec84062013-08-21 02:39:39 +1000383If the remote file contents differ from the partial local copy then the
384resultant file is likely to be corrupt.
Damien Miller0d032412013-07-25 11:56:52 +1000385.Pp
Damien Millerf29238e2013-10-17 11:48:52 +1100386If the
387.Fl f
388flag is specified, then
389.Xr fsync 2
Damien Miller1edcbf62013-10-18 10:17:17 +1100390will be called after the file transfer has completed to flush the file
Damien Millerf29238e2013-10-17 11:48:52 +1100391to disk.
392.Pp
Darren Tuckerb3b40a82009-10-07 08:39:09 +1100393If either the
Darren Tucker05016b22009-10-07 08:38:23 +1100394.Fl P
Darren Tucker1b0dd172009-10-07 08:37:48 +1100395or
396.Fl p
Darren Tucker16e254d2004-12-06 22:46:45 +1100397flag is specified, then full file permissions and access times are
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000398copied too.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100399.Pp
400If the
401.Fl r
402flag is specified then directories will be copied recursively.
403Note that
404.Nm
405does not follow symbolic links when performing recursive transfers.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000406.It Ic help
407Display help text.
Darren Tucker1f203942003-10-15 15:50:42 +1000408.It Ic lcd Ar path
409Change local directory to
410.Ar path .
Damien Millerd7686fd2001-02-10 00:40:03 +1100411.It Ic lls Op Ar ls-options Op Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000412Display local directory listing of either
Damien Miller33804262001-02-04 23:20:18 +1100413.Ar path
414or current directory if
415.Ar path
Damien Millerd7686fd2001-02-10 00:40:03 +1100416is not specified.
Darren Tucker16e254d2004-12-06 22:46:45 +1100417.Ar ls-options
418may contain any flags supported by the local system's
419.Xr ls 1
420command.
421.Ar path
422may contain
423.Xr glob 3
424characters and may match multiple files.
Damien Millerd7686fd2001-02-10 00:40:03 +1100425.It Ic lmkdir Ar path
Damien Miller33804262001-02-04 23:20:18 +1100426Create local directory specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100427.Ar path .
Darren Tuckeraf1f9092010-12-05 09:02:47 +1100428.It Xo Ic ln
429.Op Fl s
430.Ar oldpath
431.Ar newpath
432.Xc
433Create a link from
Damien Miller058316f2001-03-08 10:08:49 +1100434.Ar oldpath
435to
436.Ar newpath .
Darren Tuckeraf1f9092010-12-05 09:02:47 +1100437If the
438.Fl s
439flag is specified the created link is a symbolic link, otherwise it is
440a hard link.
Damien Millerd7686fd2001-02-10 00:40:03 +1100441.It Ic lpwd
442Print local working directory.
Damien Millere1a49812002-09-12 09:54:25 +1000443.It Xo Ic ls
Darren Tucker75fe6262010-01-15 11:42:51 +1100444.Op Fl 1afhlnrSt
Damien Millere1a49812002-09-12 09:54:25 +1000445.Op Ar path
446.Xc
Darren Tucker16e254d2004-12-06 22:46:45 +1100447Display a remote directory listing of either
Damien Miller33804262001-02-04 23:20:18 +1100448.Ar path
Darren Tucker16e254d2004-12-06 22:46:45 +1100449or the current directory if
Damien Miller33804262001-02-04 23:20:18 +1100450.Ar path
Damien Miller50677922003-05-23 18:44:04 +1000451is not specified.
Darren Tucker16e254d2004-12-06 22:46:45 +1100452.Ar path
453may contain
454.Xr glob 3
455characters and may match multiple files.
Darren Tucker15ca6e82004-06-22 13:08:21 +1000456.Pp
Darren Tucker16e254d2004-12-06 22:46:45 +1100457The following flags are recognized and alter the behaviour of
Darren Tucker15ca6e82004-06-22 13:08:21 +1000458.Ic ls
Darren Tucker16e254d2004-12-06 22:46:45 +1100459accordingly:
460.Bl -tag -width Ds
461.It Fl 1
462Produce single columnar output.
463.It Fl a
464List files beginning with a dot
465.Pq Sq \&. .
466.It Fl f
467Do not sort the listing.
468The default sort order is lexicographical.
Darren Tucker2901e2d2010-01-13 22:44:06 +1100469.It Fl h
470When used with a long format option, use unit suffixes: Byte, Kilobyte,
471Megabyte, Gigabyte, Terabyte, Petabyte, and Exabyte in order to reduce
472the number of digits to four or fewer using powers of 2 for sizes (K=1024,
473M=1048576, etc.).
Darren Tucker75fe6262010-01-15 11:42:51 +1100474.It Fl l
475Display additional details including permissions
476and ownership information.
Darren Tucker16e254d2004-12-06 22:46:45 +1100477.It Fl n
478Produce a long listing with user and group information presented
479numerically.
480.It Fl r
481Reverse the sort order of the listing.
482.It Fl S
483Sort the listing by file size.
484.It Fl t
485Sort the listing by last modification time.
486.El
Damien Millerd7686fd2001-02-10 00:40:03 +1100487.It Ic lumask Ar umask
Ben Lindstrom24643222001-06-25 05:08:11 +0000488Set local umask to
Damien Millerd7686fd2001-02-10 00:40:03 +1100489.Ar umask .
490.It Ic mkdir Ar path
491Create remote directory specified by
492.Ar path .
Damien Miller62d57f62003-01-10 21:43:24 +1100493.It Ic progress
494Toggle display of progress meter.
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000495.It Xo Ic put
Damien Millerd875ff72014-05-15 13:47:15 +1000496.Op Fl afPpr
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000497.Ar local-path
Ben Lindstromd5767812002-12-23 02:23:37 +0000498.Op Ar remote-path
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000499.Xc
Damien Miller33804262001-02-04 23:20:18 +1100500Upload
Damien Millerd7686fd2001-02-10 00:40:03 +1100501.Ar local-path
Damien Miller50677922003-05-23 18:44:04 +1000502and store it on the remote machine.
503If the remote path name is not specified, it is given the same name it has
504on the local machine.
Darren Tucker16e254d2004-12-06 22:46:45 +1100505.Ar local-path
506may contain
507.Xr glob 3
508characters and may match multiple files.
509If it does and
510.Ar remote-path
511is specified, then
512.Ar remote-path
513must specify a directory.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100514.Pp
Damien Millerf29238e2013-10-17 11:48:52 +1100515If the
Damien Miller798a0252014-05-15 13:47:37 +1000516.Fl a
Damien Millerd875ff72014-05-15 13:47:15 +1000517flag is specified, then attempt to resume partial
518transfers of existing files.
Damien Miller798a0252014-05-15 13:47:37 +1000519Note that resumption assumes that any partial copy of the remote file
Damien Millerd875ff72014-05-15 13:47:15 +1000520matches the local copy.
521If the local file contents differ from the remote local copy then
522the resultant file is likely to be corrupt.
523.Pp
524If the
Damien Millerf29238e2013-10-17 11:48:52 +1100525.Fl f
526flag is specified, then a request will be sent to the server to call
527.Xr fsync 2
528after the file has been transferred.
529Note that this is only supported by servers that implement
530the "fsync@openssh.com" extension.
531.Pp
Darren Tuckerddccfb42011-08-07 23:12:26 +1000532If either the
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000533.Fl P
Darren Tucker1b0dd172009-10-07 08:37:48 +1100534or
535.Fl p
536flag is specified, then full file permissions and access times are
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000537copied too.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100538.Pp
539If the
540.Fl r
541flag is specified then directories will be copied recursively.
542Note that
543.Nm
544does not follow symbolic links when performing recursive transfers.
Damien Millerd7686fd2001-02-10 00:40:03 +1100545.It Ic pwd
546Display remote working directory.
Damien Millerd7686fd2001-02-10 00:40:03 +1100547.It Ic quit
Damien Miller50677922003-05-23 18:44:04 +1000548Quit
549.Nm sftp .
Damien Miller0d032412013-07-25 11:56:52 +1000550.It Xo Ic reget
551.Op Fl Ppr
552.Ar remote-path
553.Op Ar local-path
554.Xc
555Resume download of
556.Ar remote-path .
557Equivalent to
558.Ic get
559with the
560.Fl a
561flag set.
Damien Millerd875ff72014-05-15 13:47:15 +1000562.It Xo Ic reput
563.Op Fl Ppr
564.Op Ar local-path
565.Ar remote-path
566.Xc
567Resume upload of
568.Op Ar local-path .
569Equivalent to
570.Ic put
Damien Miller798a0252014-05-15 13:47:37 +1000571with the
Damien Millerd875ff72014-05-15 13:47:15 +1000572.Fl a
573flag set.
Damien Millerd7686fd2001-02-10 00:40:03 +1100574.It Ic rename Ar oldpath Ar newpath
Damien Miller33804262001-02-04 23:20:18 +1100575Rename remote file from
576.Ar oldpath
577to
Damien Millerd7686fd2001-02-10 00:40:03 +1100578.Ar newpath .
Damien Millerd7686fd2001-02-10 00:40:03 +1100579.It Ic rm Ar path
Damien Miller33804262001-02-04 23:20:18 +1100580Delete remote file specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100581.Ar path .
Darren Tucker1f203942003-10-15 15:50:42 +1000582.It Ic rmdir Ar path
583Remove remote directory specified by
584.Ar path .
Damien Miller058316f2001-03-08 10:08:49 +1100585.It Ic symlink Ar oldpath Ar newpath
Ben Lindstrom24643222001-06-25 05:08:11 +0000586Create a symbolic link from
Damien Miller058316f2001-03-08 10:08:49 +1100587.Ar oldpath
588to
589.Ar newpath .
Damien Miller63421802003-01-08 14:05:23 +1100590.It Ic version
591Display the
592.Nm
593protocol version.
Damien Miller62fd18a2009-01-28 16:14:09 +1100594.It Ic \&! Ns Ar command
Ben Lindstrom24643222001-06-25 05:08:11 +0000595Execute
Damien Miller33804262001-02-04 23:20:18 +1100596.Ar command
Damien Millerd7686fd2001-02-10 00:40:03 +1100597in local shell.
Damien Millerc2b98272003-09-03 12:13:30 +1000598.It Ic \&!
Damien Millerd7686fd2001-02-10 00:40:03 +1100599Escape to local shell.
Damien Millerc2b98272003-09-03 12:13:30 +1000600.It Ic \&?
Damien Millerd7686fd2001-02-10 00:40:03 +1100601Synonym for help.
602.El
Damien Miller33804262001-02-04 23:20:18 +1100603.Sh SEE ALSO
Darren Tucker1f203942003-10-15 15:50:42 +1000604.Xr ftp 1 ,
Darren Tucker16e254d2004-12-06 22:46:45 +1100605.Xr ls 1 ,
Ben Lindstrom160ec622001-04-22 17:17:46 +0000606.Xr scp 1 ,
Damien Miller33804262001-02-04 23:20:18 +1100607.Xr ssh 1 ,
608.Xr ssh-add 1 ,
609.Xr ssh-keygen 1 ,
Darren Tucker16e254d2004-12-06 22:46:45 +1100610.Xr glob 3 ,
Ben Lindstrom3072aae2002-06-21 01:02:39 +0000611.Xr ssh_config 5 ,
Ben Lindstrom160ec622001-04-22 17:17:46 +0000612.Xr sftp-server 8 ,
613.Xr sshd 8
614.Rs
Ben Lindstrom90fd0602001-06-25 04:45:33 +0000615.%A T. Ylonen
616.%A S. Lehtinen
Ben Lindstrom160ec622001-04-22 17:17:46 +0000617.%T "SSH File Transfer Protocol"
618.%N draft-ietf-secsh-filexfer-00.txt
619.%D January 2001
620.%O work in progress material
621.Re