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