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