"update" for gss_userok API change
[openssh.git] / sftp.1
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: December 4 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
63 is an interactive file transfer program, similar to
64 .Xr ftp 1 ,
65 which performs all operations over an encrypted
66 .Xr ssh 1
67 transport.
68 It may also use many features of ssh, such as public key authentication and
69 compression.
70 .Nm
71 connects and logs into the specified
72 .Ar host ,
73 then enters an interactive command mode.
74 .Pp
75 The second usage format will retrieve files automatically if a non-interactive
76 authentication method is used; otherwise it will do so after
77 successful interactive authentication.
78 .Pp
79 The third usage format allows
80 .Nm
81 to start in a remote directory.
82 .Pp
83 The final usage format allows for automated sessions using the
84 .Fl b
85 option.
86 In such cases, it is necessary to configure non-interactive authentication
87 to obviate the need to enter a password at connection time (see
88 .Xr sshd 8
89 and
90 .Xr ssh-keygen 1
91 for details).
92 The options are as follows:
93 .Bl -tag -width Ds
94 .It Fl 1
95 Specify the use of protocol version 1.
96 .It Fl 2
97 Specify the use of protocol version 2.
98 .It Fl 4
99 Forces
100 .Nm
101 to use IPv4 addresses only.
102 .It Fl 6
103 Forces
104 .Nm
105 to use IPv6 addresses only.
106 .It Fl B Ar buffer_size
107 Specify the size of the buffer that
108 .Nm
109 uses when transferring files.
110 Larger buffers require fewer round trips at the cost of higher
111 memory consumption.
112 The default is 32768 bytes.
113 .It Fl b Ar batchfile
114 Batch mode reads a series of commands from an input
115 .Ar batchfile
116 instead of
117 .Em stdin .
118 Since it lacks user interaction it should be used in conjunction with
119 non-interactive authentication.
120 A
121 .Ar batchfile
122 of
123 .Sq \-
124 may be used to indicate standard input.
125 .Nm
126 will abort if any of the following
127 commands fail:
128 .Ic get , put , rename , ln ,
129 .Ic rm , mkdir , chdir , ls ,
130 .Ic lchdir , chmod , chown ,
131 .Ic chgrp , lpwd , df , symlink ,
132 and
133 .Ic lmkdir .
134 Termination on error can be suppressed on a command by command basis by
135 prefixing the command with a
136 .Sq \-
137 character (for example,
138 .Ic -rm /tmp/blah* ) .
139 .It Fl C
140 Enables compression (via ssh's
141 .Fl C
142 flag).
143 .It Fl c Ar cipher
144 Selects the cipher to use for encrypting the data transfers.
145 This option is directly passed to
146 .Xr ssh 1 .
147 .It Fl D Ar sftp_server_path
148 Connect directly to a local sftp server
149 (rather than via
150 .Xr ssh 1 ) .
151 This option may be useful in debugging the client and server.
152 .It Fl F Ar ssh_config
153 Specifies an alternative
154 per-user configuration file for
155 .Xr ssh 1 .
156 This option is directly passed to
157 .Xr ssh 1 .
158 .It Fl i Ar identity_file
159 Selects the file from which the identity (private key) for public key
160 authentication is read.
161 This option is directly passed to
162 .Xr ssh 1 .
163 .It Fl l Ar limit
164 Limits the used bandwidth, specified in Kbit/s.
165 .It Fl o Ar ssh_option
166 Can be used to pass options to
167 .Nm ssh
168 in the format used in
169 .Xr ssh_config 5 .
170 This is useful for specifying options
171 for which there is no separate
172 .Nm sftp
173 command-line flag.
174 For example, to specify an alternate port use:
175 .Ic sftp -oPort=24 .
176 For 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
232 Specifies the port to connect to on the remote host.
233 .It Fl p
234 Preserves modification times, access times, and modes from the
235 original files transferred.
236 .It Fl q
237 Quiet mode: disables the progress meter as well as warning and
238 diagnostic messages from
239 .Xr ssh 1 .
240 .It Fl R Ar num_requests
241 Specify how many requests may be outstanding at any one time.
242 Increasing this may slightly improve file transfer speed
243 but will increase memory usage.
244 The default is 64 outstanding requests.
245 .It Fl r
246 Recursively copy entire directories when uploading and downloading.
247 Note that
248 .Nm
249 does not follow symbolic links encountered in the tree traversal.
250 .It Fl S Ar program
251 Name of the
252 .Ar program
253 to use for the encrypted connection.
254 The program must understand
255 .Xr ssh 1
256 options.
257 .It Fl s Ar subsystem | sftp_server
258 Specifies the SSH2 subsystem or the path for an sftp server
259 on the remote host.
260 A path is useful for using
261 .Nm
262 over protocol version 1, or when the remote
263 .Xr sshd 8
264 does not have an sftp subsystem configured.
265 .It Fl v
266 Raise logging level.
267 This option is also passed to ssh.
268 .El
269 .Sh INTERACTIVE COMMANDS
270 Once in interactive mode,
271 .Nm
272 understands a set of commands similar to those of
273 .Xr ftp 1 .
274 Commands are case insensitive.
275 Pathnames that contain spaces must be enclosed in quotes.
276 Any special characters contained within pathnames that are recognized by
277 .Xr glob 3
278 must be escaped with backslashes
279 .Pq Sq \e .
280 .Bl -tag -width Ds
281 .It Ic bye
282 Quit
283 .Nm sftp .
284 .It Ic cd Ar path
285 Change remote directory to
286 .Ar path .
287 .It Ic chgrp Ar grp Ar path
288 Change group of file
289 .Ar path
290 to
291 .Ar grp .
292 .Ar path
293 may contain
294 .Xr glob 3
295 characters and may match multiple files.
296 .Ar grp
297 must be a numeric GID.
298 .It Ic chmod Ar mode Ar path
299 Change permissions of file
300 .Ar path
301 to
302 .Ar mode .
303 .Ar path
304 may contain
305 .Xr glob 3
306 characters and may match multiple files.
307 .It Ic chown Ar own Ar path
308 Change owner of file
309 .Ar path
310 to
311 .Ar own .
312 .Ar path
313 may contain
314 .Xr glob 3
315 characters and may match multiple files.
316 .Ar own
317 must be a numeric UID.
318 .It Xo Ic df
319 .Op Fl hi
320 .Op Ar path
321 .Xc
322 Display usage information for the filesystem holding the current directory
323 (or
324 .Ar path
325 if specified).
326 If the
327 .Fl h
328 flag is specified, the capacity information will be displayed using
329 "human-readable" suffixes.
330 The
331 .Fl i
332 flag requests display of inode information in addition to capacity information.
333 This command is only supported on servers that implement the
334 .Dq statvfs@openssh.com
335 extension.
336 .It Ic exit
337 Quit
338 .Nm sftp .
339 .It Xo Ic get
340 .Op Fl Ppr
341 .Ar remote-path
342 .Op Ar local-path
343 .Xc
344 Retrieve the
345 .Ar remote-path
346 and store it on the local machine.
347 If the local
348 path name is not specified, it is given the same name it has on the
349 remote machine.
350 .Ar remote-path
351 may contain
352 .Xr glob 3
353 characters and may match multiple files.
354 If it does and
355 .Ar local-path
356 is specified, then
357 .Ar local-path
358 must specify a directory.
359 .Pp
360 If either the
361 .Fl P
362 or
363 .Fl p
364 flag is specified, then full file permissions and access times are
365 copied too.
366 .Pp
367 If the
368 .Fl r
369 flag is specified then directories will be copied recursively.
370 Note that
371 .Nm
372 does not follow symbolic links when performing recursive transfers.
373 .It Ic help
374 Display help text.
375 .It Ic lcd Ar path
376 Change local directory to
377 .Ar path .
378 .It Ic lls Op Ar ls-options Op Ar path
379 Display local directory listing of either
380 .Ar path
381 or current directory if
382 .Ar path
383 is not specified.
384 .Ar ls-options
385 may contain any flags supported by the local system's
386 .Xr ls 1
387 command.
388 .Ar path
389 may contain
390 .Xr glob 3
391 characters and may match multiple files.
392 .It Ic lmkdir Ar path
393 Create local directory specified by
394 .Ar path .
395 .It Xo Ic ln
396 .Op Fl s
397 .Ar oldpath
398 .Ar newpath
399 .Xc
400 Create a link from
401 .Ar oldpath
402 to
403 .Ar newpath .
404 If the
405 .Fl s
406 flag is specified the created link is a symbolic link, otherwise it is
407 a hard link.
408 .It Ic lpwd
409 Print local working directory.
410 .It Xo Ic ls
411 .Op Fl 1afhlnrSt
412 .Op Ar path
413 .Xc
414 Display a remote directory listing of either
415 .Ar path
416 or the current directory if
417 .Ar path
418 is not specified.
419 .Ar path
420 may contain
421 .Xr glob 3
422 characters and may match multiple files.
423 .Pp
424 The following flags are recognized and alter the behaviour of
425 .Ic ls
426 accordingly:
427 .Bl -tag -width Ds
428 .It Fl 1
429 Produce single columnar output.
430 .It Fl a
431 List files beginning with a dot
432 .Pq Sq \&. .
433 .It Fl f
434 Do not sort the listing.
435 The default sort order is lexicographical.
436 .It Fl h
437 When used with a long format option, use unit suffixes: Byte, Kilobyte,
438 Megabyte, Gigabyte, Terabyte, Petabyte, and Exabyte in order to reduce
439 the number of digits to four or fewer using powers of 2 for sizes (K=1024,
440 M=1048576, etc.).
441 .It Fl l
442 Display additional details including permissions
443 and ownership information.
444 .It Fl n
445 Produce a long listing with user and group information presented
446 numerically.
447 .It Fl r
448 Reverse the sort order of the listing.
449 .It Fl S
450 Sort the listing by file size.
451 .It Fl t
452 Sort the listing by last modification time.
453 .El
454 .It Ic lumask Ar umask
455 Set local umask to
456 .Ar umask .
457 .It Ic mkdir Ar path
458 Create remote directory specified by
459 .Ar path .
460 .It Ic progress
461 Toggle display of progress meter.
462 .It Xo Ic put
463 .Op Fl Ppr
464 .Ar local-path
465 .Op Ar remote-path
466 .Xc
467 Upload
468 .Ar local-path
469 and store it on the remote machine.
470 If the remote path name is not specified, it is given the same name it has
471 on the local machine.
472 .Ar local-path
473 may contain
474 .Xr glob 3
475 characters and may match multiple files.
476 If it does and
477 .Ar remote-path
478 is specified, then
479 .Ar remote-path
480 must specify a directory.
481 .Pp
482 If ether the
483 .Fl P
484 or
485 .Fl p
486 flag is specified, then full file permissions and access times are
487 copied too.
488 .Pp
489 If the
490 .Fl r
491 flag is specified then directories will be copied recursively.
492 Note that
493 .Nm
494 does not follow symbolic links when performing recursive transfers.
495 .It Ic pwd
496 Display remote working directory.
497 .It Ic quit
498 Quit
499 .Nm sftp .
500 .It Ic rename Ar oldpath Ar newpath
501 Rename remote file from
502 .Ar oldpath
503 to
504 .Ar newpath .
505 .It Ic rm Ar path
506 Delete remote file specified by
507 .Ar path .
508 .It Ic rmdir Ar path
509 Remove remote directory specified by
510 .Ar path .
511 .It Ic symlink Ar oldpath Ar newpath
512 Create a symbolic link from
513 .Ar oldpath
514 to
515 .Ar newpath .
516 .It Ic version
517 Display the
518 .Nm
519 protocol version.
520 .It Ic \&! Ns Ar command
521 Execute
522 .Ar command
523 in local shell.
524 .It Ic \&!
525 Escape to local shell.
526 .It Ic \&?
527 Synonym 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