blob: 50e2fef0af534737c2ebde79350016b8b79b5551 [file] [log] [blame]
schwarze@openbsd.org90ef45f2018-11-13 07:22:45 +00001.\" $OpenBSD: sftp.1,v 1.121 2018/11/13 07:22:45 schwarze 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.\"
schwarze@openbsd.org90ef45f2018-11-13 07:22:45 +000025.Dd $Mdocdate: November 13 2018 $
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
Damien Miller65e42f82010-09-24 22:15:11 +100040.Op Fl l Ar limit
Darren Tucker1f203942003-10-15 15:50:42 +100041.Op Fl o Ar ssh_option
Darren Tucker282b4022009-10-07 08:23:06 +110042.Op Fl P Ar port
Damien Miller16a13332002-02-13 14:03:56 +110043.Op Fl R Ar num_requests
Ben Lindstrom6a337632001-09-18 05:47:32 +000044.Op Fl S Ar program
Darren Tucker1f203942003-10-15 15:50:42 +100045.Op Fl s Ar subsystem | sftp_server
millert@openbsd.org887669e2017-10-21 23:06:24 +000046.Ar destination
Damien Miller33804262001-02-04 23:20:18 +110047.Sh DESCRIPTION
48.Nm
millert@openbsd.org887669e2017-10-21 23:06:24 +000049is a file transfer program, similar to
Damien Miller33804262001-02-04 23:20:18 +110050.Xr ftp 1 ,
51which performs all operations over an encrypted
52.Xr ssh 1
53transport.
54It may also use many features of ssh, such as public key authentication and
55compression.
Damien Miller33804262001-02-04 23:20:18 +110056.Pp
millert@openbsd.org887669e2017-10-21 23:06:24 +000057The
58.Ar destination
59may be specified either as
jmc@openbsd.org@openbsd.org0b2e2892017-10-25 06:19:46 +000060.Sm off
61.Oo user @ Oc host Op : path
62.Sm on
63or as a URI in the form
64.Sm off
65.No sftp:// Oo user @ Oc host Oo : port Oc Op / path .
66.Sm on
millert@openbsd.org887669e2017-10-21 23:06:24 +000067.Pp
68If the
69.Ar destination
70includes a
71.Ar path
72and it is not a directory,
73.Nm
74will retrieve files automatically if a non-interactive
Ben Lindstromaafff9c2001-05-06 03:01:02 +000075authentication method is used; otherwise it will do so after
76successful interactive authentication.
Ben Lindstrom63667f62001-04-13 00:00:14 +000077.Pp
millert@openbsd.org887669e2017-10-21 23:06:24 +000078If no
79.Ar path
80is specified, or if the
81.Ar path
82is a directory,
Darren Tucker16e254d2004-12-06 22:46:45 +110083.Nm
millert@openbsd.org887669e2017-10-21 23:06:24 +000084will log in to the specified
85.Ar host
86and enter interactive command mode, changing to the remote directory
87if one was specified.
88An optional trailing slash can be used to force the
89.Ar path
90to be interpreted as a directory.
Ben Lindstrom63667f62001-04-13 00:00:14 +000091.Pp
millert@openbsd.org887669e2017-10-21 23:06:24 +000092Since the destination formats use colon characters to delimit host
93names from path names or port numbers, IPv6 addresses must be
94enclosed in square brackets to avoid ambiguity.
Damien Miller58a77e22011-05-15 08:36:29 +100095.Pp
Damien Miller33804262001-02-04 23:20:18 +110096The options are as follows:
97.Bl -tag -width Ds
Darren Tucker46bbbe32009-10-07 08:21:48 +110098.It Fl 4
99Forces
100.Nm
101to use IPv4 addresses only.
102.It Fl 6
103Forces
104.Nm
105to use IPv6 addresses only.
Damien Millerc6895c52013-08-21 02:40:21 +1000106.It Fl a
Damien Miller798a0252014-05-15 13:47:37 +1000107Attempt to continue interrupted transfers rather than overwriting
Damien Millerd875ff72014-05-15 13:47:15 +1000108existing partial or complete copies of files.
Damien Miller798a0252014-05-15 13:47:37 +1000109If the partial contents differ from those being transferred,
Damien Millerd875ff72014-05-15 13:47:15 +1000110then the resultant file is likely to be corrupt.
Darren Tucker1f203942003-10-15 15:50:42 +1000111.It Fl B Ar buffer_size
112Specify the size of the buffer that
113.Nm
114uses when transferring files.
115Larger buffers require fewer round trips at the cost of higher
116memory consumption.
117The default is 32768 bytes.
Ben Lindstrom562c26b2001-03-07 01:26:48 +0000118.It Fl b Ar batchfile
119Batch mode reads a series of commands from an input
Ben Lindstrom283cb822001-03-09 00:09:02 +0000120.Ar batchfile
Ben Lindstrom562c26b2001-03-07 01:26:48 +0000121instead of
Ben Lindstrom283cb822001-03-09 00:09:02 +0000122.Em stdin .
123Since it lacks user interaction it should be used in conjunction with
millert@openbsd.org887669e2017-10-21 23:06:24 +0000124non-interactive authentication to obviate the need to enter a password
125at connection time (see
126.Xr sshd 8
127and
128.Xr ssh-keygen 1
129for details).
Damien Miller44f75c12004-01-21 10:58:47 +1100130A
Damien Miller86a39682004-01-21 11:00:04 +1100131.Ar batchfile
132of
133.Sq \-
Damien Miller44f75c12004-01-21 10:58:47 +1100134may be used to indicate standard input.
Ben Lindstrom283cb822001-03-09 00:09:02 +0000135.Nm
Ben Lindstrom24643222001-06-25 05:08:11 +0000136will abort if any of the following
137commands fail:
schwarze@openbsd.org90ef45f2018-11-13 07:22:45 +0000138.Ic get , put , reget , reput , rename , ln ,
Damien Miller495dca32003-04-01 21:42:14 +1000139.Ic rm , mkdir , chdir , ls ,
Damien Miller64058cb2008-05-19 14:54:25 +1000140.Ic lchdir , chmod , chown ,
Darren Tuckeraf1f9092010-12-05 09:02:47 +1100141.Ic chgrp , lpwd , df , symlink ,
Ben Lindstrom562c26b2001-03-07 01:26:48 +0000142and
Ben Lindstrom283cb822001-03-09 00:09:02 +0000143.Ic lmkdir .
Damien Miller495dca32003-04-01 21:42:14 +1000144Termination on error can be suppressed on a command by command basis by
145prefixing the command with a
Damien Miller86a39682004-01-21 11:00:04 +1100146.Sq \-
Damien Miller50677922003-05-23 18:44:04 +1000147character (for example,
148.Ic -rm /tmp/blah* ) .
Darren Tucker1f203942003-10-15 15:50:42 +1000149.It Fl C
150Enables compression (via ssh's
151.Fl C
152flag).
Darren Tuckeradba1ba2009-10-07 08:22:20 +1100153.It Fl c Ar cipher
154Selects the cipher to use for encrypting the data transfers.
155This option is directly passed to
156.Xr ssh 1 .
Darren Tucker282b4022009-10-07 08:23:06 +1100157.It Fl D Ar sftp_server_path
158Connect directly to a local sftp server
159(rather than via
160.Xr ssh 1 ) .
161This option may be useful in debugging the client and server.
Darren Tucker1f203942003-10-15 15:50:42 +1000162.It Fl F Ar ssh_config
163Specifies an alternative
164per-user configuration file for
165.Xr ssh 1 .
166This option is directly passed to
167.Xr ssh 1 .
Damien Millerf29238e2013-10-17 11:48:52 +1100168.It Fl f
169Requests that files be flushed to disk immediately after transfer.
170When uploading files, this feature is only enabled if the server
171implements the "fsync@openssh.com" extension.
Darren Tucker46bbbe32009-10-07 08:21:48 +1100172.It Fl i Ar identity_file
173Selects the file from which the identity (private key) for public key
174authentication is read.
175This option is directly passed to
176.Xr ssh 1 .
Damien Miller65e42f82010-09-24 22:15:11 +1000177.It Fl l Ar limit
178Limits the used bandwidth, specified in Kbit/s.
Damien Miller33804262001-02-04 23:20:18 +1100179.It Fl o Ar ssh_option
Ben Lindstrom14c62eb2001-08-15 23:25:46 +0000180Can be used to pass options to
181.Nm ssh
Ben Lindstrom3072aae2002-06-21 01:02:39 +0000182in the format used in
183.Xr ssh_config 5 .
184This is useful for specifying options
Ben Lindstrom14c62eb2001-08-15 23:25:46 +0000185for which there is no separate
186.Nm sftp
Damien Miller50677922003-05-23 18:44:04 +1000187command-line flag.
188For example, to specify an alternate port use:
Ben Lindstrom6a337632001-09-18 05:47:32 +0000189.Ic sftp -oPort=24 .
Darren Tucker1f203942003-10-15 15:50:42 +1000190For full details of the options listed below, and their possible values, see
191.Xr ssh_config 5 .
192.Pp
193.Bl -tag -width Ds -offset indent -compact
194.It AddressFamily
195.It BatchMode
196.It BindAddress
jmc@openbsd.org7d330a12018-02-23 07:38:09 +0000197.It BindInterface
Damien Millerc0049bd2013-10-23 16:29:59 +1100198.It CanonicalDomains
199.It CanonicalizeFallbackLocal
200.It CanonicalizeHostname
201.It CanonicalizeMaxDots
202.It CanonicalizePermittedCNAMEs
jmc@openbsd.orge6933a22018-09-20 06:58:48 +0000203.It CASignatureAlgorithms
jmc@openbsd.orgc5f7c082015-09-25 18:19:54 +0000204.It CertificateFile
Darren Tucker1f203942003-10-15 15:50:42 +1000205.It ChallengeResponseAuthentication
206.It CheckHostIP
Darren Tucker1f203942003-10-15 15:50:42 +1000207.It Ciphers
Darren Tucker1f203942003-10-15 15:50:42 +1000208.It Compression
naddy@openbsd.org9a82e242017-05-03 21:49:18 +0000209.It ConnectionAttempts
Darren Tucker3d5cbb72004-05-03 09:13:15 +1000210.It ConnectTimeout
Damien Miller0e220db2004-06-15 10:34:08 +1000211.It ControlMaster
212.It ControlPath
Damien Millere5777722011-09-22 21:34:15 +1000213.It ControlPersist
Darren Tucker1f203942003-10-15 15:50:42 +1000214.It GlobalKnownHostsFile
215.It GSSAPIAuthentication
216.It GSSAPIDelegateCredentials
Damien Miller27e9c512005-03-02 12:04:16 +1100217.It HashKnownHosts
Darren Tucker1f203942003-10-15 15:50:42 +1000218.It Host
219.It HostbasedAuthentication
djm@openbsd.org46347ed2015-01-30 11:43:14 +0000220.It HostbasedKeyTypes
Darren Tucker1f203942003-10-15 15:50:42 +1000221.It HostKeyAlgorithms
222.It HostKeyAlias
223.It HostName
jmc@openbsd.org772e6ce2016-06-29 17:14:28 +0000224.It IdentitiesOnly
markus@openbsd.org75e21682016-05-04 14:32:26 +0000225.It IdentityAgent
Darren Tucker1f203942003-10-15 15:50:42 +1000226.It IdentityFile
Damien Miller0a184732010-11-20 15:21:03 +1100227.It IPQoS
Damien Millere5777722011-09-22 21:34:15 +1000228.It KbdInteractiveAuthentication
Darren Tucker636ca902004-11-05 20:22:00 +1100229.It KbdInteractiveDevices
Damien Miller2beb32f2010-09-24 22:16:03 +1000230.It KexAlgorithms
Darren Tucker1f203942003-10-15 15:50:42 +1000231.It LogLevel
232.It MACs
233.It NoHostAuthenticationForLocalhost
234.It NumberOfPasswordPrompts
235.It PasswordAuthentication
Damien Miller7ea845e2010-02-12 09:21:02 +1100236.It PKCS11Provider
Darren Tucker1f203942003-10-15 15:50:42 +1000237.It Port
238.It PreferredAuthentications
Darren Tucker1f203942003-10-15 15:50:42 +1000239.It ProxyCommand
jmc@openbsd.orge4eb7d92016-07-16 06:57:55 +0000240.It ProxyJump
jmc@openbsd.org42b690b2017-05-02 14:06:37 +0000241.It PubkeyAcceptedKeyTypes
Darren Tucker1f203942003-10-15 15:50:42 +1000242.It PubkeyAuthentication
Darren Tucker62388b22006-01-20 11:31:47 +1100243.It RekeyLimit
Darren Tucker7a6c0662004-05-02 22:14:03 +1000244.It SendEnv
Damien Miller509b0102003-12-17 16:33:10 +1100245.It ServerAliveInterval
246.It ServerAliveCountMax
jmc@openbsd.orgacf42602018-06-09 06:36:31 +0000247.It SetEnv
Darren Tucker1f203942003-10-15 15:50:42 +1000248.It StrictHostKeyChecking
Damien Miller12c150e2003-12-17 16:31:10 +1100249.It TCPKeepAlive
djm@openbsd.org1d1092b2015-01-26 12:16:36 +0000250.It UpdateHostKeys
Darren Tucker1f203942003-10-15 15:50:42 +1000251.It User
252.It UserKnownHostsFile
253.It VerifyHostKeyDNS
Darren Tucker1f203942003-10-15 15:50:42 +1000254.El
Darren Tucker282b4022009-10-07 08:23:06 +1100255.It Fl P Ar port
256Specifies the port to connect to on the remote host.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100257.It Fl p
258Preserves modification times, access times, and modes from the
259original files transferred.
Darren Tucker46bbbe32009-10-07 08:21:48 +1100260.It Fl q
261Quiet mode: disables the progress meter as well as warning and
262diagnostic messages from
263.Xr ssh 1 .
Damien Miller16a13332002-02-13 14:03:56 +1100264.It Fl R Ar num_requests
Damien Miller50677922003-05-23 18:44:04 +1000265Specify how many requests may be outstanding at any one time.
266Increasing this may slightly improve file transfer speed
267but will increase memory usage.
Damien Miller94717b02008-07-16 21:17:23 +1000268The default is 64 outstanding requests.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100269.It Fl r
270Recursively copy entire directories when uploading and downloading.
271Note that
272.Nm
273does not follow symbolic links encountered in the tree traversal.
Ben Lindstrom6a337632001-09-18 05:47:32 +0000274.It Fl S Ar program
275Name of the
276.Ar program
277to use for the encrypted connection.
278The program must understand
279.Xr ssh 1
280options.
Darren Tucker1f203942003-10-15 15:50:42 +1000281.It Fl s Ar subsystem | sftp_server
282Specifies the SSH2 subsystem or the path for an sftp server
283on the remote host.
jmc@openbsd.org2b6f7992017-05-03 06:32:02 +0000284A path is useful when the remote
Darren Tucker1f203942003-10-15 15:50:42 +1000285.Xr sshd 8
286does not have an sftp subsystem configured.
287.It Fl v
288Raise logging level.
289This option is also passed to ssh.
Damien Miller33804262001-02-04 23:20:18 +1100290.El
291.Sh INTERACTIVE COMMANDS
Damien Millerd7686fd2001-02-10 00:40:03 +1100292Once in interactive mode,
293.Nm
Ben Lindstrom24643222001-06-25 05:08:11 +0000294understands a set of commands similar to those of
Damien Miller33804262001-02-04 23:20:18 +1100295.Xr ftp 1 .
Darren Tucker16e254d2004-12-06 22:46:45 +1100296Commands are case insensitive.
297Pathnames that contain spaces must be enclosed in quotes.
298Any special characters contained within pathnames that are recognized by
299.Xr glob 3
300must be escaped with backslashes
301.Pq Sq \e .
302.Bl -tag -width Ds
Ben Lindstrom59e12492001-08-15 23:22:56 +0000303.It Ic bye
Damien Miller50677922003-05-23 18:44:04 +1000304Quit
305.Nm sftp .
djm@openbsd.org@openbsd.orgfbe8e7a2017-11-03 03:46:52 +0000306.It Ic cd Op Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000307Change remote directory to
Damien Millerd7686fd2001-02-10 00:40:03 +1100308.Ar path .
djm@openbsd.org@openbsd.orgfbe8e7a2017-11-03 03:46:52 +0000309If
310.Ar path
311is not specified, then change directory to the one the session started in.
Damien Millerd7686fd2001-02-10 00:40:03 +1100312.It Ic chgrp Ar grp Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000313Change group of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100314.Ar path
315to
Damien Miller33804262001-02-04 23:20:18 +1100316.Ar grp .
Darren Tucker16e254d2004-12-06 22:46:45 +1100317.Ar path
318may contain
kn@openbsd.orgddf1b792018-07-23 19:02:49 +0000319.Xr glob 7
Darren Tucker16e254d2004-12-06 22:46:45 +1100320characters and may match multiple files.
Damien Miller33804262001-02-04 23:20:18 +1100321.Ar grp
Damien Millerd7686fd2001-02-10 00:40:03 +1100322must be a numeric GID.
323.It Ic chmod Ar mode Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000324Change permissions of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100325.Ar path
326to
327.Ar mode .
Darren Tucker16e254d2004-12-06 22:46:45 +1100328.Ar path
329may contain
kn@openbsd.orgddf1b792018-07-23 19:02:49 +0000330.Xr glob 7
Darren Tucker16e254d2004-12-06 22:46:45 +1100331characters and may match multiple files.
Damien Millerd7686fd2001-02-10 00:40:03 +1100332.It Ic chown Ar own Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000333Change owner of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100334.Ar path
335to
Damien Miller33804262001-02-04 23:20:18 +1100336.Ar own .
Darren Tucker16e254d2004-12-06 22:46:45 +1100337.Ar path
338may contain
kn@openbsd.orgddf1b792018-07-23 19:02:49 +0000339.Xr glob 7
Darren Tucker16e254d2004-12-06 22:46:45 +1100340characters and may match multiple files.
Damien Miller33804262001-02-04 23:20:18 +1100341.Ar own
342must be a numeric UID.
Damien Millerd671e5a2008-05-19 14:53:33 +1000343.It Xo Ic df
344.Op Fl hi
345.Op Ar path
346.Xc
347Display usage information for the filesystem holding the current directory
348(or
349.Ar path
350if specified).
351If the
352.Fl h
353flag is specified, the capacity information will be displayed using
354"human-readable" suffixes.
355The
356.Fl i
357flag requests display of inode information in addition to capacity information.
358This command is only supported on servers that implement the
359.Dq statvfs@openssh.com
360extension.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000361.It Ic exit
Damien Miller50677922003-05-23 18:44:04 +1000362Quit
363.Nm sftp .
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000364.It Xo Ic get
Damien Millerf29238e2013-10-17 11:48:52 +1100365.Op Fl afPpr
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000366.Ar remote-path
367.Op Ar local-path
368.Xc
Damien Miller33804262001-02-04 23:20:18 +1100369Retrieve the
Damien Millerd7686fd2001-02-10 00:40:03 +1100370.Ar remote-path
Damien Miller33804262001-02-04 23:20:18 +1100371and store it on the local machine.
372If the local
Ben Lindstrom24643222001-06-25 05:08:11 +0000373path name is not specified, it is given the same name it has on the
Damien Miller50677922003-05-23 18:44:04 +1000374remote machine.
Darren Tucker16e254d2004-12-06 22:46:45 +1100375.Ar remote-path
376may contain
kn@openbsd.orgddf1b792018-07-23 19:02:49 +0000377.Xr glob 7
Darren Tucker16e254d2004-12-06 22:46:45 +1100378characters and may match multiple files.
379If it does and
380.Ar local-path
381is specified, then
382.Ar local-path
383must specify a directory.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100384.Pp
Damien Miller0d032412013-07-25 11:56:52 +1000385If the
386.Fl a
387flag is specified, then attempt to resume partial transfers of existing files.
388Note that resumption assumes that any partial copy of the local file matches
389the remote copy.
Damien Millereec84062013-08-21 02:39:39 +1000390If the remote file contents differ from the partial local copy then the
391resultant file is likely to be corrupt.
Damien Miller0d032412013-07-25 11:56:52 +1000392.Pp
Damien Millerf29238e2013-10-17 11:48:52 +1100393If the
394.Fl f
395flag is specified, then
396.Xr fsync 2
Damien Miller1edcbf62013-10-18 10:17:17 +1100397will be called after the file transfer has completed to flush the file
Damien Millerf29238e2013-10-17 11:48:52 +1100398to disk.
399.Pp
Darren Tuckerb3b40a82009-10-07 08:39:09 +1100400If either the
Darren Tucker05016b22009-10-07 08:38:23 +1100401.Fl P
Darren Tucker1b0dd172009-10-07 08:37:48 +1100402or
403.Fl p
Darren Tucker16e254d2004-12-06 22:46:45 +1100404flag is specified, then full file permissions and access times are
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000405copied too.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100406.Pp
407If the
408.Fl r
409flag is specified then directories will be copied recursively.
410Note that
411.Nm
412does not follow symbolic links when performing recursive transfers.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000413.It Ic help
414Display help text.
djm@openbsd.org@openbsd.orgfbe8e7a2017-11-03 03:46:52 +0000415.It Ic lcd Op Ar path
Darren Tucker1f203942003-10-15 15:50:42 +1000416Change local directory to
417.Ar path .
djm@openbsd.org@openbsd.orgfbe8e7a2017-11-03 03:46:52 +0000418If
419.Ar path
420is not specified, then change directory to the local user's home directory.
Damien Millerd7686fd2001-02-10 00:40:03 +1100421.It Ic lls Op Ar ls-options Op Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000422Display local directory listing of either
Damien Miller33804262001-02-04 23:20:18 +1100423.Ar path
424or current directory if
425.Ar path
Damien Millerd7686fd2001-02-10 00:40:03 +1100426is not specified.
Darren Tucker16e254d2004-12-06 22:46:45 +1100427.Ar ls-options
428may contain any flags supported by the local system's
429.Xr ls 1
430command.
431.Ar path
432may contain
kn@openbsd.orgddf1b792018-07-23 19:02:49 +0000433.Xr glob 7
Darren Tucker16e254d2004-12-06 22:46:45 +1100434characters and may match multiple files.
Damien Millerd7686fd2001-02-10 00:40:03 +1100435.It Ic lmkdir Ar path
Damien Miller33804262001-02-04 23:20:18 +1100436Create local directory specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100437.Ar path .
Darren Tuckeraf1f9092010-12-05 09:02:47 +1100438.It Xo Ic ln
439.Op Fl s
440.Ar oldpath
441.Ar newpath
442.Xc
443Create a link from
Damien Miller058316f2001-03-08 10:08:49 +1100444.Ar oldpath
445to
446.Ar newpath .
Darren Tuckeraf1f9092010-12-05 09:02:47 +1100447If the
448.Fl s
449flag is specified the created link is a symbolic link, otherwise it is
450a hard link.
Damien Millerd7686fd2001-02-10 00:40:03 +1100451.It Ic lpwd
452Print local working directory.
Damien Millere1a49812002-09-12 09:54:25 +1000453.It Xo Ic ls
Darren Tucker75fe6262010-01-15 11:42:51 +1100454.Op Fl 1afhlnrSt
Damien Millere1a49812002-09-12 09:54:25 +1000455.Op Ar path
456.Xc
Darren Tucker16e254d2004-12-06 22:46:45 +1100457Display a remote directory listing of either
Damien Miller33804262001-02-04 23:20:18 +1100458.Ar path
Darren Tucker16e254d2004-12-06 22:46:45 +1100459or the current directory if
Damien Miller33804262001-02-04 23:20:18 +1100460.Ar path
Damien Miller50677922003-05-23 18:44:04 +1000461is not specified.
Darren Tucker16e254d2004-12-06 22:46:45 +1100462.Ar path
463may contain
kn@openbsd.orgddf1b792018-07-23 19:02:49 +0000464.Xr glob 7
Darren Tucker16e254d2004-12-06 22:46:45 +1100465characters and may match multiple files.
Darren Tucker15ca6e82004-06-22 13:08:21 +1000466.Pp
Darren Tucker16e254d2004-12-06 22:46:45 +1100467The following flags are recognized and alter the behaviour of
Darren Tucker15ca6e82004-06-22 13:08:21 +1000468.Ic ls
Darren Tucker16e254d2004-12-06 22:46:45 +1100469accordingly:
470.Bl -tag -width Ds
471.It Fl 1
472Produce single columnar output.
473.It Fl a
474List files beginning with a dot
475.Pq Sq \&. .
476.It Fl f
477Do not sort the listing.
478The default sort order is lexicographical.
Darren Tucker2901e2d2010-01-13 22:44:06 +1100479.It Fl h
480When used with a long format option, use unit suffixes: Byte, Kilobyte,
481Megabyte, Gigabyte, Terabyte, Petabyte, and Exabyte in order to reduce
482the number of digits to four or fewer using powers of 2 for sizes (K=1024,
483M=1048576, etc.).
Darren Tucker75fe6262010-01-15 11:42:51 +1100484.It Fl l
485Display additional details including permissions
486and ownership information.
Darren Tucker16e254d2004-12-06 22:46:45 +1100487.It Fl n
488Produce a long listing with user and group information presented
489numerically.
490.It Fl r
491Reverse the sort order of the listing.
492.It Fl S
493Sort the listing by file size.
494.It Fl t
495Sort the listing by last modification time.
496.El
Damien Millerd7686fd2001-02-10 00:40:03 +1100497.It Ic lumask Ar umask
Ben Lindstrom24643222001-06-25 05:08:11 +0000498Set local umask to
Damien Millerd7686fd2001-02-10 00:40:03 +1100499.Ar umask .
500.It Ic mkdir Ar path
501Create remote directory specified by
502.Ar path .
Damien Miller62d57f62003-01-10 21:43:24 +1100503.It Ic progress
504Toggle display of progress meter.
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000505.It Xo Ic put
Damien Millerd875ff72014-05-15 13:47:15 +1000506.Op Fl afPpr
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000507.Ar local-path
Ben Lindstromd5767812002-12-23 02:23:37 +0000508.Op Ar remote-path
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000509.Xc
Damien Miller33804262001-02-04 23:20:18 +1100510Upload
Damien Millerd7686fd2001-02-10 00:40:03 +1100511.Ar local-path
Damien Miller50677922003-05-23 18:44:04 +1000512and store it on the remote machine.
513If the remote path name is not specified, it is given the same name it has
514on the local machine.
Darren Tucker16e254d2004-12-06 22:46:45 +1100515.Ar local-path
516may contain
kn@openbsd.orgddf1b792018-07-23 19:02:49 +0000517.Xr glob 7
Darren Tucker16e254d2004-12-06 22:46:45 +1100518characters and may match multiple files.
519If it does and
520.Ar remote-path
521is specified, then
522.Ar remote-path
523must specify a directory.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100524.Pp
Damien Millerf29238e2013-10-17 11:48:52 +1100525If the
Damien Miller798a0252014-05-15 13:47:37 +1000526.Fl a
Damien Millerd875ff72014-05-15 13:47:15 +1000527flag is specified, then attempt to resume partial
528transfers of existing files.
Damien Miller798a0252014-05-15 13:47:37 +1000529Note that resumption assumes that any partial copy of the remote file
Damien Millerd875ff72014-05-15 13:47:15 +1000530matches the local copy.
531If the local file contents differ from the remote local copy then
532the resultant file is likely to be corrupt.
533.Pp
534If the
Damien Millerf29238e2013-10-17 11:48:52 +1100535.Fl f
536flag is specified, then a request will be sent to the server to call
537.Xr fsync 2
538after the file has been transferred.
539Note that this is only supported by servers that implement
540the "fsync@openssh.com" extension.
541.Pp
Darren Tuckerddccfb42011-08-07 23:12:26 +1000542If either the
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000543.Fl P
Darren Tucker1b0dd172009-10-07 08:37:48 +1100544or
545.Fl p
546flag is specified, then full file permissions and access times are
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000547copied too.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100548.Pp
549If the
550.Fl r
551flag is specified then directories will be copied recursively.
552Note that
553.Nm
554does not follow symbolic links when performing recursive transfers.
Damien Millerd7686fd2001-02-10 00:40:03 +1100555.It Ic pwd
556Display remote working directory.
Damien Millerd7686fd2001-02-10 00:40:03 +1100557.It Ic quit
Damien Miller50677922003-05-23 18:44:04 +1000558Quit
559.Nm sftp .
Damien Miller0d032412013-07-25 11:56:52 +1000560.It Xo Ic reget
561.Op Fl Ppr
562.Ar remote-path
563.Op Ar local-path
564.Xc
565Resume download of
566.Ar remote-path .
567Equivalent to
568.Ic get
569with the
570.Fl a
571flag set.
Damien Millerd875ff72014-05-15 13:47:15 +1000572.It Xo Ic reput
573.Op Fl Ppr
574.Op Ar local-path
575.Ar remote-path
576.Xc
577Resume upload of
578.Op Ar local-path .
579Equivalent to
580.Ic put
Damien Miller798a0252014-05-15 13:47:37 +1000581with the
Damien Millerd875ff72014-05-15 13:47:15 +1000582.Fl a
583flag set.
Damien Millerd7686fd2001-02-10 00:40:03 +1100584.It Ic rename Ar oldpath Ar newpath
Damien Miller33804262001-02-04 23:20:18 +1100585Rename remote file from
586.Ar oldpath
587to
Damien Millerd7686fd2001-02-10 00:40:03 +1100588.Ar newpath .
Damien Millerd7686fd2001-02-10 00:40:03 +1100589.It Ic rm Ar path
Damien Miller33804262001-02-04 23:20:18 +1100590Delete remote file specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100591.Ar path .
Darren Tucker1f203942003-10-15 15:50:42 +1000592.It Ic rmdir Ar path
593Remove remote directory specified by
594.Ar path .
Damien Miller058316f2001-03-08 10:08:49 +1100595.It Ic symlink Ar oldpath Ar newpath
Ben Lindstrom24643222001-06-25 05:08:11 +0000596Create a symbolic link from
Damien Miller058316f2001-03-08 10:08:49 +1100597.Ar oldpath
598to
599.Ar newpath .
Damien Miller63421802003-01-08 14:05:23 +1100600.It Ic version
601Display the
602.Nm
603protocol version.
Damien Miller62fd18a2009-01-28 16:14:09 +1100604.It Ic \&! Ns Ar command
Ben Lindstrom24643222001-06-25 05:08:11 +0000605Execute
Damien Miller33804262001-02-04 23:20:18 +1100606.Ar command
Damien Millerd7686fd2001-02-10 00:40:03 +1100607in local shell.
Damien Millerc2b98272003-09-03 12:13:30 +1000608.It Ic \&!
Damien Millerd7686fd2001-02-10 00:40:03 +1100609Escape to local shell.
Damien Millerc2b98272003-09-03 12:13:30 +1000610.It Ic \&?
Damien Millerd7686fd2001-02-10 00:40:03 +1100611Synonym for help.
612.El
Damien Miller33804262001-02-04 23:20:18 +1100613.Sh SEE ALSO
Darren Tucker1f203942003-10-15 15:50:42 +1000614.Xr ftp 1 ,
Darren Tucker16e254d2004-12-06 22:46:45 +1100615.Xr ls 1 ,
Ben Lindstrom160ec622001-04-22 17:17:46 +0000616.Xr scp 1 ,
Damien Miller33804262001-02-04 23:20:18 +1100617.Xr ssh 1 ,
618.Xr ssh-add 1 ,
619.Xr ssh-keygen 1 ,
Ben Lindstrom3072aae2002-06-21 01:02:39 +0000620.Xr ssh_config 5 ,
jmc@openbsd.orge2127ab2018-07-23 19:53:55 +0000621.Xr glob 7 ,
Ben Lindstrom160ec622001-04-22 17:17:46 +0000622.Xr sftp-server 8 ,
623.Xr sshd 8
624.Rs
Ben Lindstrom90fd0602001-06-25 04:45:33 +0000625.%A T. Ylonen
626.%A S. Lehtinen
Ben Lindstrom160ec622001-04-22 17:17:46 +0000627.%T "SSH File Transfer Protocol"
628.%N draft-ietf-secsh-filexfer-00.txt
629.%D January 2001
630.%O work in progress material
631.Re