blob: 85d64a7fc73a4c544a3f8f38d42d0fe65ceb1c95 [file] [log] [blame]
Damien Millerc6895c52013-08-21 02:40:21 +10001.\" $OpenBSD: sftp.1,v 1.94 2013/08/07 06:24:51 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.\"
Damien Millerc6895c52013-08-21 02:40:21 +100025.Dd $Mdocdate: August 7 2013 $
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
Damien Millerc6895c52013-08-21 02:40:21 +100034.Op Fl 1246aCpqrv
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
Ben Lindstrom6a337632001-09-18 05:47:32 +000047.Ar host
Damien Miller495dca32003-04-01 21:42:14 +100048.Ek
Damien Millerd6ead282003-05-14 19:30:38 +100049.Nm sftp
Damien Miller7ebfad72008-12-09 14:12:33 +110050.Oo Ar user Ns @ Oc Ns
51.Ar host Ns Op : Ns Ar
Damien Millerd6ead282003-05-14 19:30:38 +100052.Nm sftp
Damien Miller881adf72010-09-24 22:01:54 +100053.Oo
54.Ar user Ns @ Oc Ns
Damien Miller495dca32003-04-01 21:42:14 +100055.Ar host Ns Oo : Ns Ar dir Ns
Damien Miller881adf72010-09-24 22:01:54 +100056.Op Ar /
57.Oc
Damien Millerd6ead282003-05-14 19:30:38 +100058.Nm sftp
Damien Millerfb7508e2003-05-14 13:47:07 +100059.Fl b Ar batchfile
Damien Millerc2b98272003-09-03 12:13:30 +100060.Oo Ar user Ns @ Oc Ns Ar host
Damien Miller33804262001-02-04 23:20:18 +110061.Sh DESCRIPTION
62.Nm
63is an interactive file transfer program, similar to
64.Xr ftp 1 ,
65which performs all operations over an encrypted
66.Xr ssh 1
67transport.
68It may also use many features of ssh, such as public key authentication and
69compression.
70.Nm
71connects and logs into the specified
Ben Lindstromaafff9c2001-05-06 03:01:02 +000072.Ar host ,
Damien Miller33804262001-02-04 23:20:18 +110073then enters an interactive command mode.
74.Pp
Ben Lindstrom24643222001-06-25 05:08:11 +000075The second usage format will 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
Darren Tucker16e254d2004-12-06 22:46:45 +110079The third usage format allows
80.Nm
81to start in a remote directory.
Ben Lindstrom63667f62001-04-13 00:00:14 +000082.Pp
Damien Miller50677922003-05-23 18:44:04 +100083The final usage format allows for automated sessions using the
Damien Millerfb7508e2003-05-14 13:47:07 +100084.Fl b
Damien Miller50677922003-05-23 18:44:04 +100085option.
Damien Miller134eb812005-12-31 16:22:55 +110086In such cases, it is necessary to configure non-interactive authentication
Damien Miller50677922003-05-23 18:44:04 +100087to obviate the need to enter a password at connection time (see
Damien Millerfb7508e2003-05-14 13:47:07 +100088.Xr sshd 8
Damien Millerd6ead282003-05-14 19:30:38 +100089and
Damien Millerfb7508e2003-05-14 13:47:07 +100090.Xr ssh-keygen 1
Damien Miller50677922003-05-23 18:44:04 +100091for details).
Damien Miller58a77e22011-05-15 08:36:29 +100092.Pp
93Since some usage formats use colon characters to delimit host names from path
94names, IPv6 addresses must be enclosed in square brackets to avoid ambiguity.
95.Pp
Damien Miller33804262001-02-04 23:20:18 +110096The options are as follows:
97.Bl -tag -width Ds
Darren Tucker1f203942003-10-15 15:50:42 +100098.It Fl 1
99Specify the use of protocol version 1.
Darren Tucker46bbbe32009-10-07 08:21:48 +1100100.It Fl 2
101Specify the use of protocol version 2.
102.It Fl 4
103Forces
104.Nm
105to use IPv4 addresses only.
106.It Fl 6
107Forces
108.Nm
109to use IPv6 addresses only.
Damien Millerc6895c52013-08-21 02:40:21 +1000110.It Fl a
111Attempt to continue interrupted downloads rather than overwriting existing
112partial or complete copies of files.
113If the remote file contents differ from the partial local copy then the
114resultant file is likely to be corrupt.
Darren Tucker1f203942003-10-15 15:50:42 +1000115.It Fl B Ar buffer_size
116Specify the size of the buffer that
117.Nm
118uses when transferring files.
119Larger buffers require fewer round trips at the cost of higher
120memory consumption.
121The default is 32768 bytes.
Ben Lindstrom562c26b2001-03-07 01:26:48 +0000122.It Fl b Ar batchfile
123Batch mode reads a series of commands from an input
Ben Lindstrom283cb822001-03-09 00:09:02 +0000124.Ar batchfile
Ben Lindstrom562c26b2001-03-07 01:26:48 +0000125instead of
Ben Lindstrom283cb822001-03-09 00:09:02 +0000126.Em stdin .
127Since it lacks user interaction it should be used in conjunction with
Damien Miller86a39682004-01-21 11:00:04 +1100128non-interactive authentication.
Damien Miller44f75c12004-01-21 10:58:47 +1100129A
Damien Miller86a39682004-01-21 11:00:04 +1100130.Ar batchfile
131of
132.Sq \-
Damien Miller44f75c12004-01-21 10:58:47 +1100133may be used to indicate standard input.
Ben Lindstrom283cb822001-03-09 00:09:02 +0000134.Nm
Ben Lindstrom24643222001-06-25 05:08:11 +0000135will abort if any of the following
136commands fail:
Damien Miller0d032412013-07-25 11:56:52 +1000137.Ic get , put , reget , rename , ln ,
Damien Miller495dca32003-04-01 21:42:14 +1000138.Ic rm , mkdir , chdir , ls ,
Damien Miller64058cb2008-05-19 14:54:25 +1000139.Ic lchdir , chmod , chown ,
Darren Tuckeraf1f9092010-12-05 09:02:47 +1100140.Ic chgrp , lpwd , df , symlink ,
Ben Lindstrom562c26b2001-03-07 01:26:48 +0000141and
Ben Lindstrom283cb822001-03-09 00:09:02 +0000142.Ic lmkdir .
Damien Miller495dca32003-04-01 21:42:14 +1000143Termination on error can be suppressed on a command by command basis by
144prefixing the command with a
Damien Miller86a39682004-01-21 11:00:04 +1100145.Sq \-
Damien Miller50677922003-05-23 18:44:04 +1000146character (for example,
147.Ic -rm /tmp/blah* ) .
Darren Tucker1f203942003-10-15 15:50:42 +1000148.It Fl C
149Enables compression (via ssh's
150.Fl C
151flag).
Darren Tuckeradba1ba2009-10-07 08:22:20 +1100152.It Fl c Ar cipher
153Selects the cipher to use for encrypting the data transfers.
154This option is directly passed to
155.Xr ssh 1 .
Darren Tucker282b4022009-10-07 08:23:06 +1100156.It Fl D Ar sftp_server_path
157Connect directly to a local sftp server
158(rather than via
159.Xr ssh 1 ) .
160This option may be useful in debugging the client and server.
Darren Tucker1f203942003-10-15 15:50:42 +1000161.It Fl F Ar ssh_config
162Specifies an alternative
163per-user configuration file for
164.Xr ssh 1 .
165This option is directly passed to
166.Xr ssh 1 .
Darren Tucker46bbbe32009-10-07 08:21:48 +1100167.It Fl i Ar identity_file
168Selects the file from which the identity (private key) for public key
169authentication is read.
170This option is directly passed to
171.Xr ssh 1 .
Damien Miller65e42f82010-09-24 22:15:11 +1000172.It Fl l Ar limit
173Limits the used bandwidth, specified in Kbit/s.
Damien Miller33804262001-02-04 23:20:18 +1100174.It Fl o Ar ssh_option
Ben Lindstrom14c62eb2001-08-15 23:25:46 +0000175Can be used to pass options to
176.Nm ssh
Ben Lindstrom3072aae2002-06-21 01:02:39 +0000177in the format used in
178.Xr ssh_config 5 .
179This is useful for specifying options
Ben Lindstrom14c62eb2001-08-15 23:25:46 +0000180for which there is no separate
181.Nm sftp
Damien Miller50677922003-05-23 18:44:04 +1000182command-line flag.
183For example, to specify an alternate port use:
Ben Lindstrom6a337632001-09-18 05:47:32 +0000184.Ic sftp -oPort=24 .
Darren Tucker1f203942003-10-15 15:50:42 +1000185For full details of the options listed below, and their possible values, see
186.Xr ssh_config 5 .
187.Pp
188.Bl -tag -width Ds -offset indent -compact
189.It AddressFamily
190.It BatchMode
191.It BindAddress
192.It ChallengeResponseAuthentication
193.It CheckHostIP
194.It Cipher
195.It Ciphers
Darren Tucker1f203942003-10-15 15:50:42 +1000196.It Compression
197.It CompressionLevel
198.It ConnectionAttempts
Darren Tucker3d5cbb72004-05-03 09:13:15 +1000199.It ConnectTimeout
Damien Miller0e220db2004-06-15 10:34:08 +1000200.It ControlMaster
201.It ControlPath
Damien Millere5777722011-09-22 21:34:15 +1000202.It ControlPersist
Darren Tucker1f203942003-10-15 15:50:42 +1000203.It GlobalKnownHostsFile
204.It GSSAPIAuthentication
205.It GSSAPIDelegateCredentials
Damien Miller27e9c512005-03-02 12:04:16 +1100206.It HashKnownHosts
Darren Tucker1f203942003-10-15 15:50:42 +1000207.It Host
208.It HostbasedAuthentication
209.It HostKeyAlgorithms
210.It HostKeyAlias
211.It HostName
212.It IdentityFile
Damien Millerbd394c32004-03-08 23:12:36 +1100213.It IdentitiesOnly
Damien Miller0a184732010-11-20 15:21:03 +1100214.It IPQoS
Damien Millere5777722011-09-22 21:34:15 +1000215.It KbdInteractiveAuthentication
Darren Tucker636ca902004-11-05 20:22:00 +1100216.It KbdInteractiveDevices
Damien Miller2beb32f2010-09-24 22:16:03 +1000217.It KexAlgorithms
Darren Tucker1f203942003-10-15 15:50:42 +1000218.It LogLevel
219.It MACs
220.It NoHostAuthenticationForLocalhost
221.It NumberOfPasswordPrompts
222.It PasswordAuthentication
Damien Miller7ea845e2010-02-12 09:21:02 +1100223.It PKCS11Provider
Darren Tucker1f203942003-10-15 15:50:42 +1000224.It Port
225.It PreferredAuthentications
226.It Protocol
227.It ProxyCommand
228.It PubkeyAuthentication
Darren Tucker62388b22006-01-20 11:31:47 +1100229.It RekeyLimit
Darren Tucker1f203942003-10-15 15:50:42 +1000230.It RhostsRSAAuthentication
231.It RSAAuthentication
Darren Tucker7a6c0662004-05-02 22:14:03 +1000232.It SendEnv
Damien Miller509b0102003-12-17 16:33:10 +1100233.It ServerAliveInterval
234.It ServerAliveCountMax
Darren Tucker1f203942003-10-15 15:50:42 +1000235.It StrictHostKeyChecking
Damien Miller12c150e2003-12-17 16:31:10 +1100236.It TCPKeepAlive
Darren Tucker1f203942003-10-15 15:50:42 +1000237.It UsePrivilegedPort
238.It User
239.It UserKnownHostsFile
240.It VerifyHostKeyDNS
Darren Tucker1f203942003-10-15 15:50:42 +1000241.El
Darren Tucker282b4022009-10-07 08:23:06 +1100242.It Fl P Ar port
243Specifies the port to connect to on the remote host.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100244.It Fl p
245Preserves modification times, access times, and modes from the
246original files transferred.
Darren Tucker46bbbe32009-10-07 08:21:48 +1100247.It Fl q
248Quiet mode: disables the progress meter as well as warning and
249diagnostic messages from
250.Xr ssh 1 .
Damien Miller16a13332002-02-13 14:03:56 +1100251.It Fl R Ar num_requests
Damien Miller50677922003-05-23 18:44:04 +1000252Specify how many requests may be outstanding at any one time.
253Increasing this may slightly improve file transfer speed
254but will increase memory usage.
Damien Miller94717b02008-07-16 21:17:23 +1000255The default is 64 outstanding requests.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100256.It Fl r
257Recursively copy entire directories when uploading and downloading.
258Note that
259.Nm
260does not follow symbolic links encountered in the tree traversal.
Ben Lindstrom6a337632001-09-18 05:47:32 +0000261.It Fl S Ar program
262Name of the
263.Ar program
264to use for the encrypted connection.
265The program must understand
266.Xr ssh 1
267options.
Darren Tucker1f203942003-10-15 15:50:42 +1000268.It Fl s Ar subsystem | sftp_server
269Specifies the SSH2 subsystem or the path for an sftp server
270on the remote host.
271A path is useful for using
272.Nm
273over protocol version 1, or when the remote
274.Xr sshd 8
275does not have an sftp subsystem configured.
276.It Fl v
277Raise logging level.
278This option is also passed to ssh.
Damien Miller33804262001-02-04 23:20:18 +1100279.El
280.Sh INTERACTIVE COMMANDS
Damien Millerd7686fd2001-02-10 00:40:03 +1100281Once in interactive mode,
282.Nm
Ben Lindstrom24643222001-06-25 05:08:11 +0000283understands a set of commands similar to those of
Damien Miller33804262001-02-04 23:20:18 +1100284.Xr ftp 1 .
Darren Tucker16e254d2004-12-06 22:46:45 +1100285Commands are case insensitive.
286Pathnames that contain spaces must be enclosed in quotes.
287Any special characters contained within pathnames that are recognized by
288.Xr glob 3
289must be escaped with backslashes
290.Pq Sq \e .
291.Bl -tag -width Ds
Ben Lindstrom59e12492001-08-15 23:22:56 +0000292.It Ic bye
Damien Miller50677922003-05-23 18:44:04 +1000293Quit
294.Nm sftp .
Damien Millerd7686fd2001-02-10 00:40:03 +1100295.It Ic cd Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000296Change remote directory to
Damien Millerd7686fd2001-02-10 00:40:03 +1100297.Ar path .
Damien Millerd7686fd2001-02-10 00:40:03 +1100298.It Ic chgrp Ar grp Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000299Change group of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100300.Ar path
301to
Damien Miller33804262001-02-04 23:20:18 +1100302.Ar grp .
Darren Tucker16e254d2004-12-06 22:46:45 +1100303.Ar path
304may contain
305.Xr glob 3
306characters and may match multiple files.
Damien Miller33804262001-02-04 23:20:18 +1100307.Ar grp
Damien Millerd7686fd2001-02-10 00:40:03 +1100308must be a numeric GID.
309.It Ic chmod Ar mode Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000310Change permissions of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100311.Ar path
312to
313.Ar mode .
Darren Tucker16e254d2004-12-06 22:46:45 +1100314.Ar path
315may contain
316.Xr glob 3
317characters and may match multiple files.
Damien Millerd7686fd2001-02-10 00:40:03 +1100318.It Ic chown Ar own Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000319Change owner of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100320.Ar path
321to
Damien Miller33804262001-02-04 23:20:18 +1100322.Ar own .
Darren Tucker16e254d2004-12-06 22:46:45 +1100323.Ar path
324may contain
325.Xr glob 3
326characters and may match multiple files.
Damien Miller33804262001-02-04 23:20:18 +1100327.Ar own
328must be a numeric UID.
Damien Millerd671e5a2008-05-19 14:53:33 +1000329.It Xo Ic df
330.Op Fl hi
331.Op Ar path
332.Xc
333Display usage information for the filesystem holding the current directory
334(or
335.Ar path
336if specified).
337If the
338.Fl h
339flag is specified, the capacity information will be displayed using
340"human-readable" suffixes.
341The
342.Fl i
343flag requests display of inode information in addition to capacity information.
344This command is only supported on servers that implement the
345.Dq statvfs@openssh.com
346extension.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000347.It Ic exit
Damien Miller50677922003-05-23 18:44:04 +1000348Quit
349.Nm sftp .
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000350.It Xo Ic get
Damien Miller0d032412013-07-25 11:56:52 +1000351.Op Fl aPpr
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000352.Ar remote-path
353.Op Ar local-path
354.Xc
Damien Miller33804262001-02-04 23:20:18 +1100355Retrieve the
Damien Millerd7686fd2001-02-10 00:40:03 +1100356.Ar remote-path
Damien Miller33804262001-02-04 23:20:18 +1100357and store it on the local machine.
358If the local
Ben Lindstrom24643222001-06-25 05:08:11 +0000359path name is not specified, it is given the same name it has on the
Damien Miller50677922003-05-23 18:44:04 +1000360remote machine.
Darren Tucker16e254d2004-12-06 22:46:45 +1100361.Ar remote-path
362may contain
363.Xr glob 3
364characters and may match multiple files.
365If it does and
366.Ar local-path
367is specified, then
368.Ar local-path
369must specify a directory.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100370.Pp
Damien Miller0d032412013-07-25 11:56:52 +1000371If the
372.Fl a
373flag is specified, then attempt to resume partial transfers of existing files.
374Note that resumption assumes that any partial copy of the local file matches
375the remote copy.
Damien Millereec84062013-08-21 02:39:39 +1000376If the remote file contents differ from the partial local copy then the
377resultant file is likely to be corrupt.
Damien Miller0d032412013-07-25 11:56:52 +1000378.Pp
Darren Tuckerb3b40a82009-10-07 08:39:09 +1100379If either the
Darren Tucker05016b22009-10-07 08:38:23 +1100380.Fl P
Darren Tucker1b0dd172009-10-07 08:37:48 +1100381or
382.Fl p
Darren Tucker16e254d2004-12-06 22:46:45 +1100383flag is specified, then full file permissions and access times are
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000384copied too.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100385.Pp
386If the
387.Fl r
388flag is specified then directories will be copied recursively.
389Note that
390.Nm
391does not follow symbolic links when performing recursive transfers.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000392.It Ic help
393Display help text.
Darren Tucker1f203942003-10-15 15:50:42 +1000394.It Ic lcd Ar path
395Change local directory to
396.Ar path .
Damien Millerd7686fd2001-02-10 00:40:03 +1100397.It Ic lls Op Ar ls-options Op Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000398Display local directory listing of either
Damien Miller33804262001-02-04 23:20:18 +1100399.Ar path
400or current directory if
401.Ar path
Damien Millerd7686fd2001-02-10 00:40:03 +1100402is not specified.
Darren Tucker16e254d2004-12-06 22:46:45 +1100403.Ar ls-options
404may contain any flags supported by the local system's
405.Xr ls 1
406command.
407.Ar path
408may contain
409.Xr glob 3
410characters and may match multiple files.
Damien Millerd7686fd2001-02-10 00:40:03 +1100411.It Ic lmkdir Ar path
Damien Miller33804262001-02-04 23:20:18 +1100412Create local directory specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100413.Ar path .
Darren Tuckeraf1f9092010-12-05 09:02:47 +1100414.It Xo Ic ln
415.Op Fl s
416.Ar oldpath
417.Ar newpath
418.Xc
419Create a link from
Damien Miller058316f2001-03-08 10:08:49 +1100420.Ar oldpath
421to
422.Ar newpath .
Darren Tuckeraf1f9092010-12-05 09:02:47 +1100423If the
424.Fl s
425flag is specified the created link is a symbolic link, otherwise it is
426a hard link.
Damien Millerd7686fd2001-02-10 00:40:03 +1100427.It Ic lpwd
428Print local working directory.
Damien Millere1a49812002-09-12 09:54:25 +1000429.It Xo Ic ls
Darren Tucker75fe6262010-01-15 11:42:51 +1100430.Op Fl 1afhlnrSt
Damien Millere1a49812002-09-12 09:54:25 +1000431.Op Ar path
432.Xc
Darren Tucker16e254d2004-12-06 22:46:45 +1100433Display a remote directory listing of either
Damien Miller33804262001-02-04 23:20:18 +1100434.Ar path
Darren Tucker16e254d2004-12-06 22:46:45 +1100435or the current directory if
Damien Miller33804262001-02-04 23:20:18 +1100436.Ar path
Damien Miller50677922003-05-23 18:44:04 +1000437is not specified.
Darren Tucker16e254d2004-12-06 22:46:45 +1100438.Ar path
439may contain
440.Xr glob 3
441characters and may match multiple files.
Darren Tucker15ca6e82004-06-22 13:08:21 +1000442.Pp
Darren Tucker16e254d2004-12-06 22:46:45 +1100443The following flags are recognized and alter the behaviour of
Darren Tucker15ca6e82004-06-22 13:08:21 +1000444.Ic ls
Darren Tucker16e254d2004-12-06 22:46:45 +1100445accordingly:
446.Bl -tag -width Ds
447.It Fl 1
448Produce single columnar output.
449.It Fl a
450List files beginning with a dot
451.Pq Sq \&. .
452.It Fl f
453Do not sort the listing.
454The default sort order is lexicographical.
Darren Tucker2901e2d2010-01-13 22:44:06 +1100455.It Fl h
456When used with a long format option, use unit suffixes: Byte, Kilobyte,
457Megabyte, Gigabyte, Terabyte, Petabyte, and Exabyte in order to reduce
458the number of digits to four or fewer using powers of 2 for sizes (K=1024,
459M=1048576, etc.).
Darren Tucker75fe6262010-01-15 11:42:51 +1100460.It Fl l
461Display additional details including permissions
462and ownership information.
Darren Tucker16e254d2004-12-06 22:46:45 +1100463.It Fl n
464Produce a long listing with user and group information presented
465numerically.
466.It Fl r
467Reverse the sort order of the listing.
468.It Fl S
469Sort the listing by file size.
470.It Fl t
471Sort the listing by last modification time.
472.El
Damien Millerd7686fd2001-02-10 00:40:03 +1100473.It Ic lumask Ar umask
Ben Lindstrom24643222001-06-25 05:08:11 +0000474Set local umask to
Damien Millerd7686fd2001-02-10 00:40:03 +1100475.Ar umask .
476.It Ic mkdir Ar path
477Create remote directory specified by
478.Ar path .
Damien Miller62d57f62003-01-10 21:43:24 +1100479.It Ic progress
480Toggle display of progress meter.
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000481.It Xo Ic put
Darren Tucker05016b22009-10-07 08:38:23 +1100482.Op Fl Ppr
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000483.Ar local-path
Ben Lindstromd5767812002-12-23 02:23:37 +0000484.Op Ar remote-path
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000485.Xc
Damien Miller33804262001-02-04 23:20:18 +1100486Upload
Damien Millerd7686fd2001-02-10 00:40:03 +1100487.Ar local-path
Damien Miller50677922003-05-23 18:44:04 +1000488and store it on the remote machine.
489If the remote path name is not specified, it is given the same name it has
490on the local machine.
Darren Tucker16e254d2004-12-06 22:46:45 +1100491.Ar local-path
492may contain
493.Xr glob 3
494characters and may match multiple files.
495If it does and
496.Ar remote-path
497is specified, then
498.Ar remote-path
499must specify a directory.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100500.Pp
Darren Tuckerddccfb42011-08-07 23:12:26 +1000501If either the
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000502.Fl P
Darren Tucker1b0dd172009-10-07 08:37:48 +1100503or
504.Fl p
505flag is specified, then full file permissions and access times are
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000506copied too.
Darren Tucker1b0dd172009-10-07 08:37:48 +1100507.Pp
508If the
509.Fl r
510flag is specified then directories will be copied recursively.
511Note that
512.Nm
513does not follow symbolic links when performing recursive transfers.
Damien Millerd7686fd2001-02-10 00:40:03 +1100514.It Ic pwd
515Display remote working directory.
Damien Millerd7686fd2001-02-10 00:40:03 +1100516.It Ic quit
Damien Miller50677922003-05-23 18:44:04 +1000517Quit
518.Nm sftp .
Damien Miller0d032412013-07-25 11:56:52 +1000519.It Xo Ic reget
520.Op Fl Ppr
521.Ar remote-path
522.Op Ar local-path
523.Xc
524Resume download of
525.Ar remote-path .
526Equivalent to
527.Ic get
528with the
529.Fl a
530flag set.
Damien Millerd7686fd2001-02-10 00:40:03 +1100531.It Ic rename Ar oldpath Ar newpath
Damien Miller33804262001-02-04 23:20:18 +1100532Rename remote file from
533.Ar oldpath
534to
Damien Millerd7686fd2001-02-10 00:40:03 +1100535.Ar newpath .
Damien Millerd7686fd2001-02-10 00:40:03 +1100536.It Ic rm Ar path
Damien Miller33804262001-02-04 23:20:18 +1100537Delete remote file specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100538.Ar path .
Darren Tucker1f203942003-10-15 15:50:42 +1000539.It Ic rmdir Ar path
540Remove remote directory specified by
541.Ar path .
Damien Miller058316f2001-03-08 10:08:49 +1100542.It Ic symlink Ar oldpath Ar newpath
Ben Lindstrom24643222001-06-25 05:08:11 +0000543Create a symbolic link from
Damien Miller058316f2001-03-08 10:08:49 +1100544.Ar oldpath
545to
546.Ar newpath .
Damien Miller63421802003-01-08 14:05:23 +1100547.It Ic version
548Display the
549.Nm
550protocol version.
Damien Miller62fd18a2009-01-28 16:14:09 +1100551.It Ic \&! Ns Ar command
Ben Lindstrom24643222001-06-25 05:08:11 +0000552Execute
Damien Miller33804262001-02-04 23:20:18 +1100553.Ar command
Damien Millerd7686fd2001-02-10 00:40:03 +1100554in local shell.
Damien Millerc2b98272003-09-03 12:13:30 +1000555.It Ic \&!
Damien Millerd7686fd2001-02-10 00:40:03 +1100556Escape to local shell.
Damien Millerc2b98272003-09-03 12:13:30 +1000557.It Ic \&?
Damien Millerd7686fd2001-02-10 00:40:03 +1100558Synonym for help.
559.El
Damien Miller33804262001-02-04 23:20:18 +1100560.Sh SEE ALSO
Darren Tucker1f203942003-10-15 15:50:42 +1000561.Xr ftp 1 ,
Darren Tucker16e254d2004-12-06 22:46:45 +1100562.Xr ls 1 ,
Ben Lindstrom160ec622001-04-22 17:17:46 +0000563.Xr scp 1 ,
Damien Miller33804262001-02-04 23:20:18 +1100564.Xr ssh 1 ,
565.Xr ssh-add 1 ,
566.Xr ssh-keygen 1 ,
Darren Tucker16e254d2004-12-06 22:46:45 +1100567.Xr glob 3 ,
Ben Lindstrom3072aae2002-06-21 01:02:39 +0000568.Xr ssh_config 5 ,
Ben Lindstrom160ec622001-04-22 17:17:46 +0000569.Xr sftp-server 8 ,
570.Xr sshd 8
571.Rs
Ben Lindstrom90fd0602001-06-25 04:45:33 +0000572.%A T. Ylonen
573.%A S. Lehtinen
Ben Lindstrom160ec622001-04-22 17:17:46 +0000574.%T "SSH File Transfer Protocol"
575.%N draft-ietf-secsh-filexfer-00.txt
576.%D January 2001
577.%O work in progress material
578.Re