Deleted Added
full compact
1.\" $OpenBSD: sftp.1,v 1.88 2010/12/04 00:18:01 djm Exp $
2.\"
3.\" Copyright (c) 2001 Damien Miller. All rights reserved.
4.\"
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.\"
25.Dd $Mdocdate: November 18 2010 $
26.Dt SFTP 1
27.Os
28.Sh NAME
29.Nm sftp
30.Nd secure file transfer program
31.Sh SYNOPSIS
32.Nm sftp
33.Bk -words
34.Op Fl 1246Cpqrv
35.Op Fl B Ar buffer_size
36.Op Fl b Ar batchfile
37.Op Fl c Ar cipher
38.Op Fl D Ar sftp_server_path
39.Op Fl F Ar ssh_config
40.Op Fl i Ar identity_file
41.Op Fl l Ar limit
42.Op Fl o Ar ssh_option
43.Op Fl P Ar port
44.Op Fl R Ar num_requests
45.Op Fl S Ar program
46.Op Fl s Ar subsystem | sftp_server
47.Ar host
48.Ek
49.Nm sftp
50.Oo Ar user Ns @ Oc Ns
51.Ar host Ns Op : Ns Ar
52.Nm sftp
53.Oo
54.Ar user Ns @ Oc Ns
55.Ar host Ns Oo : Ns Ar dir Ns
56.Op Ar /
57.Oc
58.Nm sftp
59.Fl b Ar batchfile
60.Oo Ar user Ns @ Oc Ns Ar host
61.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
72.Ar host ,
73then enters an interactive command mode.
74.Pp
75The second usage format will retrieve files automatically if a non-interactive
76authentication method is used; otherwise it will do so after
77successful interactive authentication.
78.Pp
79The third usage format allows
80.Nm
81to start in a remote directory.
82.Pp
83The final usage format allows for automated sessions using the
84.Fl b
85option.
86In such cases, it is necessary to configure non-interactive authentication
87to obviate the need to enter a password at connection time (see
88.Xr sshd 8
89and
90.Xr ssh-keygen 1
91for details).
92The options are as follows:
93.Bl -tag -width Ds
94.It Fl 1
95Specify the use of protocol version 1.
96.It Fl 2
97Specify the use of protocol version 2.
98.It Fl 4
99Forces
100.Nm
101to use IPv4 addresses only.
102.It Fl 6
103Forces
104.Nm
105to use IPv6 addresses only.
106.It Fl B Ar buffer_size
107Specify the size of the buffer that
108.Nm
109uses when transferring files.
110Larger buffers require fewer round trips at the cost of higher
111memory consumption.
112The default is 32768 bytes.
113.It Fl b Ar batchfile
114Batch mode reads a series of commands from an input
115.Ar batchfile
116instead of
117.Em stdin .
118Since it lacks user interaction it should be used in conjunction with
119non-interactive authentication.
120A
121.Ar batchfile
122of
123.Sq \-
124may be used to indicate standard input.
125.Nm
126will abort if any of the following
127commands fail:
128.Ic get , put , rename , ln ,
129.Ic rm , mkdir , chdir , ls ,
130.Ic lchdir , chmod , chown ,
131.Ic chgrp , lpwd , df , symlink ,
132and
133.Ic lmkdir .
134Termination on error can be suppressed on a command by command basis by
135prefixing the command with a
136.Sq \-
137character (for example,
138.Ic -rm /tmp/blah* ) .
139.It Fl C
140Enables compression (via ssh's
141.Fl C
142flag).
143.It Fl c Ar cipher
144Selects the cipher to use for encrypting the data transfers.
145This option is directly passed to
146.Xr ssh 1 .
147.It Fl D Ar sftp_server_path
148Connect directly to a local sftp server
149(rather than via
150.Xr ssh 1 ) .
151This option may be useful in debugging the client and server.
152.It Fl F Ar ssh_config
153Specifies an alternative
154per-user configuration file for
155.Xr ssh 1 .
156This option is directly passed to
157.Xr ssh 1 .
158.It Fl i Ar identity_file
159Selects the file from which the identity (private key) for public key
160authentication is read.
161This option is directly passed to
162.Xr ssh 1 .
163.It Fl l Ar limit
164Limits the used bandwidth, specified in Kbit/s.
165.It Fl o Ar ssh_option
166Can be used to pass options to
167.Nm ssh
168in the format used in
169.Xr ssh_config 5 .
170This is useful for specifying options
171for which there is no separate
172.Nm sftp
173command-line flag.
174For example, to specify an alternate port use:
175.Ic sftp -oPort=24 .
176For full details of the options listed below, and their possible values, see
177.Xr ssh_config 5 .
178.Pp
179.Bl -tag -width Ds -offset indent -compact
180.It AddressFamily
181.It BatchMode
182.It BindAddress
183.It ChallengeResponseAuthentication
184.It CheckHostIP
185.It Cipher
186.It Ciphers
187.It Compression
188.It CompressionLevel
189.It ConnectionAttempts
190.It ConnectTimeout
191.It ControlMaster
192.It ControlPath
193.It GlobalKnownHostsFile
194.It GSSAPIAuthentication
195.It GSSAPIDelegateCredentials
196.It HashKnownHosts
197.It Host
198.It HostbasedAuthentication
199.It HostKeyAlgorithms
200.It HostKeyAlias
201.It HostName
202.It IdentityFile
203.It IdentitiesOnly
204.It IPQoS
205.It KbdInteractiveDevices
206.It KexAlgorithms
207.It LogLevel
208.It MACs
209.It NoHostAuthenticationForLocalhost
210.It NumberOfPasswordPrompts
211.It PasswordAuthentication
212.It PKCS11Provider
213.It Port
214.It PreferredAuthentications
215.It Protocol
216.It ProxyCommand
217.It PubkeyAuthentication
218.It RekeyLimit
219.It RhostsRSAAuthentication
220.It RSAAuthentication
221.It SendEnv
222.It ServerAliveInterval
223.It ServerAliveCountMax
224.It StrictHostKeyChecking
225.It TCPKeepAlive
226.It UsePrivilegedPort
227.It User
228.It UserKnownHostsFile
229.It VerifyHostKeyDNS
230.El
231.It Fl P Ar port
232Specifies the port to connect to on the remote host.
233.It Fl p
234Preserves modification times, access times, and modes from the
235original files transferred.
236.It Fl q
237Quiet mode: disables the progress meter as well as warning and
238diagnostic messages from
239.Xr ssh 1 .
240.It Fl R Ar num_requests
241Specify how many requests may be outstanding at any one time.
242Increasing this may slightly improve file transfer speed
243but will increase memory usage.
244The default is 64 outstanding requests.
245.It Fl r
246Recursively copy entire directories when uploading and downloading.
247Note that
248.Nm
249does not follow symbolic links encountered in the tree traversal.
250.It Fl S Ar program
251Name of the
252.Ar program
253to use for the encrypted connection.
254The program must understand
255.Xr ssh 1
256options.
257.It Fl s Ar subsystem | sftp_server
258Specifies the SSH2 subsystem or the path for an sftp server
259on the remote host.
260A path is useful for using
261.Nm
262over protocol version 1, or when the remote
263.Xr sshd 8
264does not have an sftp subsystem configured.
265.It Fl v
266Raise logging level.
267This option is also passed to ssh.
268.El
269.Sh INTERACTIVE COMMANDS
270Once in interactive mode,
271.Nm
272understands a set of commands similar to those of
273.Xr ftp 1 .
274Commands are case insensitive.
275Pathnames that contain spaces must be enclosed in quotes.
276Any special characters contained within pathnames that are recognized by
277.Xr glob 3
278must be escaped with backslashes
279.Pq Sq \e .
280.Bl -tag -width Ds
281.It Ic bye
282Quit
283.Nm sftp .
284.It Ic cd Ar path
285Change remote directory to
286.Ar path .
287.It Ic chgrp Ar grp Ar path
288Change group of file
289.Ar path
290to
291.Ar grp .
292.Ar path
293may contain
294.Xr glob 3
295characters and may match multiple files.
296.Ar grp
297must be a numeric GID.
298.It Ic chmod Ar mode Ar path
299Change permissions of file
300.Ar path
301to
302.Ar mode .
303.Ar path
304may contain
305.Xr glob 3
306characters and may match multiple files.
307.It Ic chown Ar own Ar path
308Change owner of file
309.Ar path
310to
311.Ar own .
312.Ar path
313may contain
314.Xr glob 3
315characters and may match multiple files.
316.Ar own
317must be a numeric UID.
318.It Xo Ic df
319.Op Fl hi
320.Op Ar path
321.Xc
322Display usage information for the filesystem holding the current directory
323(or
324.Ar path
325if specified).
326If the
327.Fl h
328flag is specified, the capacity information will be displayed using
329"human-readable" suffixes.
330The
331.Fl i
332flag requests display of inode information in addition to capacity information.
333This command is only supported on servers that implement the
334.Dq statvfs@openssh.com
335extension.
336.It Ic exit
337Quit
338.Nm sftp .
339.It Xo Ic get
340.Op Fl Ppr
341.Ar remote-path
342.Op Ar local-path
343.Xc
344Retrieve the
345.Ar remote-path
346and store it on the local machine.
347If the local
348path name is not specified, it is given the same name it has on the
349remote machine.
350.Ar remote-path
351may contain
352.Xr glob 3
353characters and may match multiple files.
354If it does and
355.Ar local-path
356is specified, then
357.Ar local-path
358must specify a directory.
359.Pp
360If either the
361.Fl P
362or
363.Fl p
364flag is specified, then full file permissions and access times are
365copied too.
366.Pp
367If the
368.Fl r
369flag is specified then directories will be copied recursively.
370Note that
371.Nm
372does not follow symbolic links when performing recursive transfers.
373.It Ic help
374Display help text.
375.It Ic lcd Ar path
376Change local directory to
377.Ar path .
378.It Ic lls Op Ar ls-options Op Ar path
379Display local directory listing of either
380.Ar path
381or current directory if
382.Ar path
383is not specified.
384.Ar ls-options
385may contain any flags supported by the local system's
386.Xr ls 1
387command.
388.Ar path
389may contain
390.Xr glob 3
391characters and may match multiple files.
392.It Ic lmkdir Ar path
393Create local directory specified by
394.Ar path .
395.It Xo Ic ln
396.Op Fl s
397.Ar oldpath
398.Ar newpath
399.Xc
400Create a link from
401.Ar oldpath
402to
403.Ar newpath .
404If the
405.Fl s
406flag is specified the created link is a symbolic link, otherwise it is
407a hard link.
408.It Ic lpwd
409Print local working directory.
410.It Xo Ic ls
411.Op Fl 1afhlnrSt
412.Op Ar path
413.Xc
414Display a remote directory listing of either
415.Ar path
416or the current directory if
417.Ar path
418is not specified.
419.Ar path
420may contain
421.Xr glob 3
422characters and may match multiple files.
423.Pp
424The following flags are recognized and alter the behaviour of
425.Ic ls
426accordingly:
427.Bl -tag -width Ds
428.It Fl 1
429Produce single columnar output.
430.It Fl a
431List files beginning with a dot
432.Pq Sq \&. .
433.It Fl f
434Do not sort the listing.
435The default sort order is lexicographical.
436.It Fl h
437When used with a long format option, use unit suffixes: Byte, Kilobyte,
438Megabyte, Gigabyte, Terabyte, Petabyte, and Exabyte in order to reduce
439the number of digits to four or fewer using powers of 2 for sizes (K=1024,
440M=1048576, etc.).
441.It Fl l
442Display additional details including permissions
443and ownership information.
444.It Fl n
445Produce a long listing with user and group information presented
446numerically.
447.It Fl r
448Reverse the sort order of the listing.
449.It Fl S
450Sort the listing by file size.
451.It Fl t
452Sort the listing by last modification time.
453.El
454.It Ic lumask Ar umask
455Set local umask to
456.Ar umask .
457.It Ic mkdir Ar path
458Create remote directory specified by
459.Ar path .
460.It Ic progress
461Toggle display of progress meter.
462.It Xo Ic put
463.Op Fl Ppr
464.Ar local-path
465.Op Ar remote-path
466.Xc
467Upload
468.Ar local-path
469and store it on the remote machine.
470If the remote path name is not specified, it is given the same name it has
471on the local machine.
472.Ar local-path
473may contain
474.Xr glob 3
475characters and may match multiple files.
476If it does and
477.Ar remote-path
478is specified, then
479.Ar remote-path
480must specify a directory.
481.Pp
482If ether the
483.Fl P
484or
485.Fl p
486flag is specified, then full file permissions and access times are
487copied too.
488.Pp
489If the
490.Fl r
491flag is specified then directories will be copied recursively.
492Note that
493.Nm
494does not follow symbolic links when performing recursive transfers.
495.It Ic pwd
496Display remote working directory.
497.It Ic quit
498Quit
499.Nm sftp .
500.It Ic rename Ar oldpath Ar newpath
501Rename remote file from
502.Ar oldpath
503to
504.Ar newpath .
505.It Ic rm Ar path
506Delete remote file specified by
507.Ar path .
508.It Ic rmdir Ar path
509Remove remote directory specified by
510.Ar path .
511.It Ic symlink Ar oldpath Ar newpath
512Create a symbolic link from
513.Ar oldpath
514to
515.Ar newpath .
516.It Ic version
517Display the
518.Nm
519protocol version.
520.It Ic \&! Ns Ar command
521Execute
522.Ar command
523in local shell.
524.It Ic \&!
525Escape to local shell.
526.It Ic \&?
527Synonym for help.
528.El
529.Sh SEE ALSO
530.Xr ftp 1 ,
531.Xr ls 1 ,
532.Xr scp 1 ,
533.Xr ssh 1 ,
534.Xr ssh-add 1 ,
535.Xr ssh-keygen 1 ,
536.Xr glob 3 ,
537.Xr ssh_config 5 ,
538.Xr sftp-server 8 ,
539.Xr sshd 8
540.Rs
541.%A T. Ylonen
542.%A S. Lehtinen
543.%T "SSH File Transfer Protocol"
544.%N draft-ietf-secsh-filexfer-00.txt
545.%D January 2001
546.%O work in progress material
547.Re