]>
Commit | Line | Data |
---|---|---|
bad23583 | 1 | .\" $OpenBSD: sftp.1,v 1.79 2009/12/29 16:38:41 stevesk Exp $ |
61e96248 | 2 | .\" |
f3c7c613 | 3 | .\" Copyright (c) 2001 Damien Miller. All rights reserved. |
61e96248 | 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 | .\" | |
e473dcd1 | 25 | .Dd $Mdocdate$ |
61e96248 | 26 | .Dt SFTP 1 |
27 | .Os | |
28 | .Sh NAME | |
29 | .Nm sftp | |
bd47824b | 30 | .Nd secure file transfer program |
61e96248 | 31 | .Sh SYNOPSIS |
72c5fe79 | 32 | .Nm sftp |
a4e5acef | 33 | .Bk -words |
d141f964 | 34 | .Op Fl 1246Cpqrv |
7d5e8c46 | 35 | .Op Fl B Ar buffer_size |
433e60ac | 36 | .Op Fl b Ar batchfile |
3496b8d4 | 37 | .Op Fl c Ar cipher |
97658f13 | 38 | .Op Fl D Ar sftp_server_path |
7d5e8c46 | 39 | .Op Fl F Ar ssh_config |
5aa0f160 | 40 | .Op Fl i Ar identity_file |
433e60ac | 41 | .Op Fl o Ar ssh_option |
97658f13 | 42 | .Op Fl P Ar port |
c25d3df7 | 43 | .Op Fl R Ar num_requests |
e3c1c3e6 | 44 | .Op Fl S Ar program |
433e60ac | 45 | .Op Fl s Ar subsystem | sftp_server |
e3c1c3e6 | 46 | .Ar host |
a4e5acef | 47 | .Ek |
72c5fe79 | 48 | .Nm sftp |
83cd8c39 | 49 | .Oo Ar user Ns @ Oc Ns |
50 | .Ar host Ns Op : Ns Ar | |
72c5fe79 | 51 | .Nm sftp |
83cd8c39 | 52 | .Oo Ar user Ns @ Oc Ns |
a4e5acef | 53 | .Ar host Ns Oo : Ns Ar dir Ns |
d3cd4016 | 54 | .Op Ar / Oc |
72c5fe79 | 55 | .Nm sftp |
81466908 | 56 | .Fl b Ar batchfile |
d0445371 | 57 | .Oo Ar user Ns @ Oc Ns Ar host |
61e96248 | 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 | |
cf7ff074 | 69 | .Ar host , |
61e96248 | 70 | then enters an interactive command mode. |
71 | .Pp | |
3730bb22 | 72 | The second usage format will retrieve files automatically if a non-interactive |
cf7ff074 | 73 | authentication method is used; otherwise it will do so after |
74 | successful interactive authentication. | |
edeeab1e | 75 | .Pp |
f9d52dd1 | 76 | The third usage format allows |
77 | .Nm | |
78 | to start in a remote directory. | |
edeeab1e | 79 | .Pp |
bd47824b | 80 | The final usage format allows for automated sessions using the |
81466908 | 81 | .Fl b |
bd47824b | 82 | option. |
3da242db | 83 | In such cases, it is necessary to configure non-interactive authentication |
bd47824b | 84 | to obviate the need to enter a password at connection time (see |
81466908 | 85 | .Xr sshd 8 |
72c5fe79 | 86 | and |
81466908 | 87 | .Xr ssh-keygen 1 |
bd47824b | 88 | for details). |
61e96248 | 89 | The options are as follows: |
90 | .Bl -tag -width Ds | |
433e60ac | 91 | .It Fl 1 |
92 | Specify the use of protocol version 1. | |
3496b8d4 | 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. | |
433e60ac | 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. | |
a5ec8a3d | 110 | .It Fl b Ar batchfile |
111 | Batch mode reads a series of commands from an input | |
acf06a60 | 112 | .Ar batchfile |
a5ec8a3d | 113 | instead of |
acf06a60 | 114 | .Em stdin . |
115 | Since it lacks user interaction it should be used in conjunction with | |
f74de0d7 | 116 | non-interactive authentication. |
a8b64bb8 | 117 | A |
f74de0d7 | 118 | .Ar batchfile |
119 | of | |
120 | .Sq \- | |
a8b64bb8 | 121 | may be used to indicate standard input. |
acf06a60 | 122 | .Nm |
3730bb22 | 123 | will abort if any of the following |
124 | commands fail: | |
7e35f994 | 125 | .Ic get , put , rename , ln , |
a4e5acef | 126 | .Ic rm , mkdir , chdir , ls , |
ea530517 | 127 | .Ic lchdir , chmod , chown , |
128 | .Ic chgrp , lpwd , df , | |
a5ec8a3d | 129 | and |
acf06a60 | 130 | .Ic lmkdir . |
a4e5acef | 131 | Termination on error can be suppressed on a command by command basis by |
132 | prefixing the command with a | |
f74de0d7 | 133 | .Sq \- |
bd47824b | 134 | character (for example, |
135 | .Ic -rm /tmp/blah* ) . | |
433e60ac | 136 | .It Fl C |
137 | Enables compression (via ssh's | |
138 | .Fl C | |
139 | flag). | |
b68241c3 | 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 . | |
97658f13 | 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. | |
433e60ac | 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 . | |
3496b8d4 | 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 . | |
61e96248 | 160 | .It Fl o Ar ssh_option |
38539909 | 161 | Can be used to pass options to |
162 | .Nm ssh | |
c21a7c4a | 163 | in the format used in |
164 | .Xr ssh_config 5 . | |
165 | This is useful for specifying options | |
38539909 | 166 | for which there is no separate |
167 | .Nm sftp | |
bd47824b | 168 | command-line flag. |
169 | For example, to specify an alternate port use: | |
e3c1c3e6 | 170 | .Ic sftp -oPort=24 . |
433e60ac | 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 | |
433e60ac | 182 | .It Compression |
183 | .It CompressionLevel | |
184 | .It ConnectionAttempts | |
927fcba2 | 185 | .It ConnectTimeout |
5e96b616 | 186 | .It ControlMaster |
187 | .It ControlPath | |
433e60ac | 188 | .It GlobalKnownHostsFile |
189 | .It GSSAPIAuthentication | |
190 | .It GSSAPIDelegateCredentials | |
ba9d1100 | 191 | .It HashKnownHosts |
433e60ac | 192 | .It Host |
193 | .It HostbasedAuthentication | |
194 | .It HostKeyAlgorithms | |
195 | .It HostKeyAlias | |
196 | .It HostName | |
197 | .It IdentityFile | |
3a065ed0 | 198 | .It IdentitiesOnly |
396070f8 | 199 | .It KbdInteractiveDevices |
433e60ac | 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 | |
db175906 | 210 | .It RekeyLimit |
433e60ac | 211 | .It RhostsRSAAuthentication |
bad23583 | 212 | .It RoutingDomain |
433e60ac | 213 | .It RSAAuthentication |
8e99a198 | 214 | .It SendEnv |
5d8d32a3 | 215 | .It ServerAliveInterval |
216 | .It ServerAliveCountMax | |
433e60ac | 217 | .It SmartcardDevice |
218 | .It StrictHostKeyChecking | |
fd573618 | 219 | .It TCPKeepAlive |
433e60ac | 220 | .It UsePrivilegedPort |
221 | .It User | |
222 | .It UserKnownHostsFile | |
223 | .It VerifyHostKeyDNS | |
433e60ac | 224 | .El |
97658f13 | 225 | .It Fl P Ar port |
226 | Specifies the port to connect to on the remote host. | |
d141f964 | 227 | .It Fl p |
228 | Preserves modification times, access times, and modes from the | |
229 | original files transferred. | |
3496b8d4 | 230 | .It Fl q |
231 | Quiet mode: disables the progress meter as well as warning and | |
232 | diagnostic messages from | |
233 | .Xr ssh 1 . | |
c25d3df7 | 234 | .It Fl R Ar num_requests |
bd47824b | 235 | Specify how many requests may be outstanding at any one time. |
236 | Increasing this may slightly improve file transfer speed | |
237 | but will increase memory usage. | |
b8c9ea19 | 238 | The default is 64 outstanding requests. |
d141f964 | 239 | .It Fl r |
240 | Recursively copy entire directories when uploading and downloading. | |
241 | Note that | |
242 | .Nm | |
243 | does not follow symbolic links encountered in the tree traversal. | |
e3c1c3e6 | 244 | .It Fl S Ar program |
245 | Name of the | |
246 | .Ar program | |
247 | to use for the encrypted connection. | |
248 | The program must understand | |
249 | .Xr ssh 1 | |
250 | options. | |
433e60ac | 251 | .It Fl s Ar subsystem | sftp_server |
252 | Specifies the SSH2 subsystem or the path for an sftp server | |
253 | on the remote host. | |
254 | A path is useful for using | |
255 | .Nm | |
256 | over protocol version 1, or when the remote | |
257 | .Xr sshd 8 | |
258 | does not have an sftp subsystem configured. | |
259 | .It Fl v | |
260 | Raise logging level. | |
261 | This option is also passed to ssh. | |
61e96248 | 262 | .El |
263 | .Sh INTERACTIVE COMMANDS | |
0426a3b4 | 264 | Once in interactive mode, |
265 | .Nm | |
3730bb22 | 266 | understands a set of commands similar to those of |
61e96248 | 267 | .Xr ftp 1 . |
f9d52dd1 | 268 | Commands are case insensitive. |
269 | Pathnames that contain spaces must be enclosed in quotes. | |
270 | Any special characters contained within pathnames that are recognized by | |
271 | .Xr glob 3 | |
272 | must be escaped with backslashes | |
273 | .Pq Sq \e . | |
274 | .Bl -tag -width Ds | |
68874d2b | 275 | .It Ic bye |
bd47824b | 276 | Quit |
277 | .Nm sftp . | |
0426a3b4 | 278 | .It Ic cd Ar path |
3730bb22 | 279 | Change remote directory to |
0426a3b4 | 280 | .Ar path . |
0426a3b4 | 281 | .It Ic chgrp Ar grp Ar path |
3730bb22 | 282 | Change group of file |
0426a3b4 | 283 | .Ar path |
284 | to | |
61e96248 | 285 | .Ar grp . |
f9d52dd1 | 286 | .Ar path |
287 | may contain | |
288 | .Xr glob 3 | |
289 | characters and may match multiple files. | |
61e96248 | 290 | .Ar grp |
0426a3b4 | 291 | must be a numeric GID. |
292 | .It Ic chmod Ar mode Ar path | |
3730bb22 | 293 | Change permissions of file |
0426a3b4 | 294 | .Ar path |
295 | to | |
296 | .Ar mode . | |
f9d52dd1 | 297 | .Ar path |
298 | may contain | |
299 | .Xr glob 3 | |
300 | characters and may match multiple files. | |
0426a3b4 | 301 | .It Ic chown Ar own Ar path |
3730bb22 | 302 | Change owner of file |
0426a3b4 | 303 | .Ar path |
304 | to | |
61e96248 | 305 | .Ar own . |
f9d52dd1 | 306 | .Ar path |
307 | may contain | |
308 | .Xr glob 3 | |
309 | characters and may match multiple files. | |
61e96248 | 310 | .Ar own |
311 | must be a numeric UID. | |
360b43ab | 312 | .It Xo Ic df |
313 | .Op Fl hi | |
314 | .Op Ar path | |
315 | .Xc | |
316 | Display usage information for the filesystem holding the current directory | |
317 | (or | |
318 | .Ar path | |
319 | if specified). | |
320 | If the | |
321 | .Fl h | |
322 | flag is specified, the capacity information will be displayed using | |
323 | "human-readable" suffixes. | |
324 | The | |
325 | .Fl i | |
326 | flag requests display of inode information in addition to capacity information. | |
327 | This command is only supported on servers that implement the | |
328 | .Dq statvfs@openssh.com | |
329 | extension. | |
17910dce | 330 | .It Ic exit |
bd47824b | 331 | Quit |
332 | .Nm sftp . | |
58c54a79 | 333 | .It Xo Ic get |
d141f964 | 334 | .Op Fl Ppr |
58c54a79 | 335 | .Ar remote-path |
336 | .Op Ar local-path | |
337 | .Xc | |
61e96248 | 338 | Retrieve the |
0426a3b4 | 339 | .Ar remote-path |
61e96248 | 340 | and store it on the local machine. |
341 | If the local | |
3730bb22 | 342 | path name is not specified, it is given the same name it has on the |
bd47824b | 343 | remote machine. |
f9d52dd1 | 344 | .Ar remote-path |
345 | may contain | |
346 | .Xr glob 3 | |
347 | characters and may match multiple files. | |
348 | If it does and | |
349 | .Ar local-path | |
350 | is specified, then | |
351 | .Ar local-path | |
352 | must specify a directory. | |
d141f964 | 353 | .Pp |
3829cbca | 354 | If either the |
e83f55f9 | 355 | .Fl P |
d141f964 | 356 | or |
357 | .Fl p | |
f9d52dd1 | 358 | flag is specified, then full file permissions and access times are |
58c54a79 | 359 | copied too. |
d141f964 | 360 | .Pp |
361 | If the | |
362 | .Fl r | |
363 | flag is specified then directories will be copied recursively. | |
364 | Note that | |
365 | .Nm | |
366 | does not follow symbolic links when performing recursive transfers. | |
17910dce | 367 | .It Ic help |
368 | Display help text. | |
433e60ac | 369 | .It Ic lcd Ar path |
370 | Change local directory to | |
371 | .Ar path . | |
0426a3b4 | 372 | .It Ic lls Op Ar ls-options Op Ar path |
3730bb22 | 373 | Display local directory listing of either |
61e96248 | 374 | .Ar path |
375 | or current directory if | |
376 | .Ar path | |
0426a3b4 | 377 | is not specified. |
f9d52dd1 | 378 | .Ar ls-options |
379 | may contain any flags supported by the local system's | |
380 | .Xr ls 1 | |
381 | command. | |
382 | .Ar path | |
383 | may contain | |
384 | .Xr glob 3 | |
385 | characters and may match multiple files. | |
0426a3b4 | 386 | .It Ic lmkdir Ar path |
61e96248 | 387 | Create local directory specified by |
0426a3b4 | 388 | .Ar path . |
3a7fe5ba | 389 | .It Ic ln Ar oldpath Ar newpath |
3730bb22 | 390 | Create a symbolic link from |
3a7fe5ba | 391 | .Ar oldpath |
392 | to | |
393 | .Ar newpath . | |
0426a3b4 | 394 | .It Ic lpwd |
395 | Print local working directory. | |
00b3ad3e | 396 | .It Xo Ic ls |
f9d52dd1 | 397 | .Op Fl 1aflnrSt |
00b3ad3e | 398 | .Op Ar path |
399 | .Xc | |
f9d52dd1 | 400 | Display a remote directory listing of either |
61e96248 | 401 | .Ar path |
f9d52dd1 | 402 | or the current directory if |
0426a3b4 | 403 | .Ar path |
bd47824b | 404 | is not specified. |
f9d52dd1 | 405 | .Ar path |
406 | may contain | |
407 | .Xr glob 3 | |
408 | characters and may match multiple files. | |
c4c84934 | 409 | .Pp |
f9d52dd1 | 410 | The following flags are recognized and alter the behaviour of |
c4c84934 | 411 | .Ic ls |
f9d52dd1 | 412 | accordingly: |
413 | .Bl -tag -width Ds | |
414 | .It Fl 1 | |
415 | Produce single columnar output. | |
416 | .It Fl a | |
417 | List files beginning with a dot | |
418 | .Pq Sq \&. . | |
419 | .It Fl f | |
420 | Do not sort the listing. | |
421 | The default sort order is lexicographical. | |
422 | .It Fl l | |
423 | Display additional details including permissions | |
424 | and ownership information. | |
425 | .It Fl n | |
426 | Produce a long listing with user and group information presented | |
427 | numerically. | |
428 | .It Fl r | |
429 | Reverse the sort order of the listing. | |
430 | .It Fl S | |
431 | Sort the listing by file size. | |
432 | .It Fl t | |
433 | Sort the listing by last modification time. | |
434 | .El | |
0426a3b4 | 435 | .It Ic lumask Ar umask |
3730bb22 | 436 | Set local umask to |
0426a3b4 | 437 | .Ar umask . |
438 | .It Ic mkdir Ar path | |
61e96248 | 439 | Create remote directory specified by |
0426a3b4 | 440 | .Ar path . |
b65c3807 | 441 | .It Ic progress |
442 | Toggle display of progress meter. | |
58c54a79 | 443 | .It Xo Ic put |
e83f55f9 | 444 | .Op Fl Ppr |
58c54a79 | 445 | .Ar local-path |
2ea16b0b | 446 | .Op Ar remote-path |
58c54a79 | 447 | .Xc |
61e96248 | 448 | Upload |
0426a3b4 | 449 | .Ar local-path |
bd47824b | 450 | and store it on the remote machine. |
451 | If the remote path name is not specified, it is given the same name it has | |
452 | on the local machine. | |
f9d52dd1 | 453 | .Ar local-path |
454 | may contain | |
455 | .Xr glob 3 | |
456 | characters and may match multiple files. | |
457 | If it does and | |
458 | .Ar remote-path | |
459 | is specified, then | |
460 | .Ar remote-path | |
461 | must specify a directory. | |
d141f964 | 462 | .Pp |
463 | If ether the | |
58c54a79 | 464 | .Fl P |
d141f964 | 465 | or |
466 | .Fl p | |
467 | flag is specified, then full file permissions and access times are | |
58c54a79 | 468 | copied too. |
d141f964 | 469 | .Pp |
470 | If the | |
471 | .Fl r | |
472 | flag is specified then directories will be copied recursively. | |
473 | Note that | |
474 | .Nm | |
475 | does not follow symbolic links when performing recursive transfers. | |
0426a3b4 | 476 | .It Ic pwd |
477 | Display remote working directory. | |
0426a3b4 | 478 | .It Ic quit |
bd47824b | 479 | Quit |
480 | .Nm sftp . | |
0426a3b4 | 481 | .It Ic rename Ar oldpath Ar newpath |
61e96248 | 482 | Rename remote file from |
483 | .Ar oldpath | |
484 | to | |
0426a3b4 | 485 | .Ar newpath . |
0426a3b4 | 486 | .It Ic rm Ar path |
61e96248 | 487 | Delete remote file specified by |
0426a3b4 | 488 | .Ar path . |
433e60ac | 489 | .It Ic rmdir Ar path |
490 | Remove remote directory specified by | |
491 | .Ar path . | |
3a7fe5ba | 492 | .It Ic symlink Ar oldpath Ar newpath |
3730bb22 | 493 | Create a symbolic link from |
3a7fe5ba | 494 | .Ar oldpath |
495 | to | |
496 | .Ar newpath . | |
048ff12c | 497 | .It Ic version |
498 | Display the | |
499 | .Nm | |
500 | protocol version. | |
d3cd4016 | 501 | .It Ic \&! Ns Ar command |
3730bb22 | 502 | Execute |
61e96248 | 503 | .Ar command |
0426a3b4 | 504 | in local shell. |
d0445371 | 505 | .It Ic \&! |
0426a3b4 | 506 | Escape to local shell. |
d0445371 | 507 | .It Ic \&? |
0426a3b4 | 508 | Synonym for help. |
509 | .El | |
61e96248 | 510 | .Sh SEE ALSO |
433e60ac | 511 | .Xr ftp 1 , |
f9d52dd1 | 512 | .Xr ls 1 , |
2cad6cef | 513 | .Xr scp 1 , |
61e96248 | 514 | .Xr ssh 1 , |
515 | .Xr ssh-add 1 , | |
516 | .Xr ssh-keygen 1 , | |
f9d52dd1 | 517 | .Xr glob 3 , |
c21a7c4a | 518 | .Xr ssh_config 5 , |
2cad6cef | 519 | .Xr sftp-server 8 , |
520 | .Xr sshd 8 | |
521 | .Rs | |
7b518233 | 522 | .%A T. Ylonen |
523 | .%A S. Lehtinen | |
2cad6cef | 524 | .%T "SSH File Transfer Protocol" |
525 | .%N draft-ietf-secsh-filexfer-00.txt | |
526 | .%D January 2001 | |
527 | .%O work in progress material | |
528 | .Re |