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