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