1SFTP(1)                    OpenBSD Reference Manual                    SFTP(1)
2
3NAME
4     sftp - secure file transfer program
5
6SYNOPSIS
7     sftp [-1246aCfpqrv] [-B buffer_size] [-b batchfile] [-c cipher]
8          [-D sftp_server_path] [-F ssh_config] [-i identity_file] [-l limit]
9          [-o ssh_option] [-P port] [-R num_requests] [-S program]
10          [-s subsystem | sftp_server] host
11     sftp [user@]host[:file ...]
12     sftp [user@]host[:dir[/]]
13     sftp -b batchfile [user@]host
14
15DESCRIPTION
16     sftp is an interactive file transfer program, similar to ftp(1), which
17     performs all operations over an encrypted ssh(1) transport.  It may also
18     use many features of ssh, such as public key authentication and
19     compression.  sftp connects and logs into the specified host, then enters
20     an interactive command mode.
21
22     The second usage format will retrieve files automatically if a non-
23     interactive authentication method is used; otherwise it will do so after
24     successful interactive authentication.
25
26     The third usage format allows sftp to start in a remote directory.
27
28     The final usage format allows for automated sessions using the -b option.
29     In such cases, it is necessary to configure non-interactive
30     authentication to obviate the need to enter a password at connection time
31     (see sshd(8) and ssh-keygen(1) for details).
32
33     Since some usage formats use colon characters to delimit host names from
34     path names, IPv6 addresses must be enclosed in square brackets to avoid
35     ambiguity.
36
37     The options are as follows:
38
39     -1      Specify the use of protocol version 1.
40
41     -2      Specify the use of protocol version 2.
42
43     -4      Forces sftp to use IPv4 addresses only.
44
45     -6      Forces sftp to use IPv6 addresses only.
46
47     -a      Attempt to continue interrupted downloads rather than overwriting
48             existing partial or complete copies of files.  If the remote file
49             contents differ from the partial local copy then the resultant
50             file is likely to be corrupt.
51
52     -B buffer_size
53             Specify the size of the buffer that sftp uses when transferring
54             files.  Larger buffers require fewer round trips at the cost of
55             higher memory consumption.  The default is 32768 bytes.
56
57     -b batchfile
58             Batch mode reads a series of commands from an input batchfile
59             instead of stdin.  Since it lacks user interaction it should be
60             used in conjunction with non-interactive authentication.  A
61             batchfile of `-' may be used to indicate standard input.  sftp
62             will abort if any of the following commands fail: get, put,
63             reget, rename, ln, rm, mkdir, chdir, ls, lchdir, chmod, chown,
64             chgrp, lpwd, df, symlink, and lmkdir.  Termination on error can
65             be suppressed on a command by command basis by prefixing the
66             command with a `-' character (for example, -rm /tmp/blah*).
67
68     -C      Enables compression (via ssh's -C flag).
69
70     -c cipher
71             Selects the cipher to use for encrypting the data transfers.
72             This option is directly passed to ssh(1).
73
74     -D sftp_server_path
75             Connect directly to a local sftp server (rather than via ssh(1)).
76             This option may be useful in debugging the client and server.
77
78     -F ssh_config
79             Specifies an alternative per-user configuration file for ssh(1).
80             This option is directly passed to ssh(1).
81
82     -f      Requests that files be flushed to disk immediately after
83             transfer.  When uploading files, this feature is only enabled if
84             the server implements the "fsync@openssh.com" extension.
85
86     -i identity_file
87             Selects the file from which the identity (private key) for public
88             key authentication is read.  This option is directly passed to
89             ssh(1).
90
91     -l limit
92             Limits the used bandwidth, specified in Kbit/s.
93
94     -o ssh_option
95             Can be used to pass options to ssh in the format used in
96             ssh_config(5).  This is useful for specifying options for which
97             there is no separate sftp command-line flag.  For example, to
98             specify an alternate port use: sftp -oPort=24.  For full details
99             of the options listed below, and their possible values, see
100             ssh_config(5).
101
102                   AddressFamily
103                   BatchMode
104                   BindAddress
105                   CanonicalDomains
106                   CanonicalizeFallbackLocal
107                   CanonicalizeHostname
108                   CanonicalizeMaxDots
109                   CanonicalizePermittedCNAMEs
110                   ChallengeResponseAuthentication
111                   CheckHostIP
112                   Cipher
113                   Ciphers
114                   Compression
115                   CompressionLevel
116                   ConnectionAttempts
117                   ConnectTimeout
118                   ControlMaster
119                   ControlPath
120                   ControlPersist
121                   GlobalKnownHostsFile
122                   GSSAPIAuthentication
123                   GSSAPIDelegateCredentials
124                   HashKnownHosts
125                   Host
126                   HostbasedAuthentication
127                   HostKeyAlgorithms
128                   HostKeyAlias
129                   HostName
130                   IdentityFile
131                   IdentitiesOnly
132                   IPQoS
133                   KbdInteractiveAuthentication
134                   KbdInteractiveDevices
135                   KexAlgorithms
136                   LogLevel
137                   MACs
138                   NoHostAuthenticationForLocalhost
139                   NumberOfPasswordPrompts
140                   PasswordAuthentication
141                   PKCS11Provider
142                   Port
143                   PreferredAuthentications
144                   Protocol
145                   ProxyCommand
146                   PubkeyAuthentication
147                   RekeyLimit
148                   RhostsRSAAuthentication
149                   RSAAuthentication
150                   SendEnv
151                   ServerAliveInterval
152                   ServerAliveCountMax
153                   StrictHostKeyChecking
154                   TCPKeepAlive
155                   UsePrivilegedPort
156                   User
157                   UserKnownHostsFile
158                   VerifyHostKeyDNS
159
160     -P port
161             Specifies the port to connect to on the remote host.
162
163     -p      Preserves modification times, access times, and modes from the
164             original files transferred.
165
166     -q      Quiet mode: disables the progress meter as well as warning and
167             diagnostic messages from ssh(1).
168
169     -R num_requests
170             Specify how many requests may be outstanding at any one time.
171             Increasing this may slightly improve file transfer speed but will
172             increase memory usage.  The default is 64 outstanding requests.
173
174     -r      Recursively copy entire directories when uploading and
175             downloading.  Note that sftp does not follow symbolic links
176             encountered in the tree traversal.
177
178     -S program
179             Name of the program to use for the encrypted connection.  The
180             program must understand ssh(1) options.
181
182     -s subsystem | sftp_server
183             Specifies the SSH2 subsystem or the path for an sftp server on
184             the remote host.  A path is useful for using sftp over protocol
185             version 1, or when the remote sshd(8) does not have an sftp
186             subsystem configured.
187
188     -v      Raise logging level.  This option is also passed to ssh.
189
190INTERACTIVE COMMANDS
191     Once in interactive mode, sftp understands a set of commands similar to
192     those of ftp(1).  Commands are case insensitive.  Pathnames that contain
193     spaces must be enclosed in quotes.  Any special characters contained
194     within pathnames that are recognized by glob(3) must be escaped with
195     backslashes (`\').
196
197     bye     Quit sftp.
198
199     cd path
200             Change remote directory to path.
201
202     chgrp grp path
203             Change group of file path to grp.  path may contain glob(3)
204             characters and may match multiple files.  grp must be a numeric
205             GID.
206
207     chmod mode path
208             Change permissions of file path to mode.  path may contain
209             glob(3) characters and may match multiple files.
210
211     chown own path
212             Change owner of file path to own.  path may contain glob(3)
213             characters and may match multiple files.  own must be a numeric
214             UID.
215
216     df [-hi] [path]
217             Display usage information for the filesystem holding the current
218             directory (or path if specified).  If the -h flag is specified,
219             the capacity information will be displayed using "human-readable"
220             suffixes.  The -i flag requests display of inode information in
221             addition to capacity information.  This command is only supported
222             on servers that implement the ``statvfs@openssh.com'' extension.
223
224     exit    Quit sftp.
225
226     get [-afPpr] remote-path [local-path]
227             Retrieve the remote-path and store it on the local machine.  If
228             the local path name is not specified, it is given the same name
229             it has on the remote machine.  remote-path may contain glob(3)
230             characters and may match multiple files.  If it does and
231             local-path is specified, then local-path must specify a
232             directory.
233
234             If the -a flag is specified, then attempt to resume partial
235             transfers of existing files.  Note that resumption assumes that
236             any partial copy of the local file matches the remote copy.  If
237             the remote file contents differ from the partial local copy then
238             the resultant file is likely to be corrupt.
239
240             If the -f flag is specified, then fsync(2) will be called after
241             the file transfer has completed to flush the file to disk.
242
243             If either the -P or -p flag is specified, then full file
244             permissions and access times are copied too.
245
246             If the -r flag is specified then directories will be copied
247             recursively.  Note that sftp does not follow symbolic links when
248             performing recursive transfers.
249
250     help    Display help text.
251
252     lcd path
253             Change local directory to path.
254
255     lls [ls-options [path]]
256             Display local directory listing of either path or current
257             directory if path is not specified.  ls-options may contain any
258             flags supported by the local system's ls(1) command.  path may
259             contain glob(3) characters and may match multiple files.
260
261     lmkdir path
262             Create local directory specified by path.
263
264     ln [-s] oldpath newpath
265             Create a link from oldpath to newpath.  If the -s flag is
266             specified the created link is a symbolic link, otherwise it is a
267             hard link.
268
269     lpwd    Print local working directory.
270
271     ls [-1afhlnrSt] [path]
272             Display a remote directory listing of either path or the current
273             directory if path is not specified.  path may contain glob(3)
274             characters and may match multiple files.
275
276             The following flags are recognized and alter the behaviour of ls
277             accordingly:
278
279             -1      Produce single columnar output.
280
281             -a      List files beginning with a dot (`.').
282
283             -f      Do not sort the listing.  The default sort order is
284                     lexicographical.
285
286             -h      When used with a long format option, use unit suffixes:
287                     Byte, Kilobyte, Megabyte, Gigabyte, Terabyte, Petabyte,
288                     and Exabyte in order to reduce the number of digits to
289                     four or fewer using powers of 2 for sizes (K=1024,
290                     M=1048576, etc.).
291
292             -l      Display additional details including permissions and
293                     ownership information.
294
295             -n      Produce a long listing with user and group information
296                     presented numerically.
297
298             -r      Reverse the sort order of the listing.
299
300             -S      Sort the listing by file size.
301
302             -t      Sort the listing by last modification time.
303
304     lumask umask
305             Set local umask to umask.
306
307     mkdir path
308             Create remote directory specified by path.
309
310     progress
311             Toggle display of progress meter.
312
313     put [-fPpr] local-path [remote-path]
314             Upload local-path and store it on the remote machine.  If the
315             remote path name is not specified, it is given the same name it
316             has on the local machine.  local-path may contain glob(3)
317             characters and may match multiple files.  If it does and
318             remote-path is specified, then remote-path must specify a
319             directory.
320
321             If the -f flag is specified, then a request will be sent to the
322             server to call fsync(2) after the file has been transferred.
323             Note that this is only supported by servers that implement the
324             "fsync@openssh.com" extension.
325
326             If either the -P or -p flag is specified, then full file
327             permissions and access times are copied too.
328
329             If the -r flag is specified then directories will be copied
330             recursively.  Note that sftp does not follow symbolic links when
331             performing recursive transfers.
332
333     pwd     Display remote working directory.
334
335     quit    Quit sftp.
336
337     reget [-Ppr] remote-path [local-path]
338             Resume download of remote-path.  Equivalent to get with the -a
339             flag set.
340
341     rename oldpath newpath
342             Rename remote file from oldpath to newpath.
343
344     rm path
345             Delete remote file specified by path.
346
347     rmdir path
348             Remove remote directory specified by path.
349
350     symlink oldpath newpath
351             Create a symbolic link from oldpath to newpath.
352
353     version
354             Display the sftp protocol version.
355
356     !command
357             Execute command in local shell.
358
359     !       Escape to local shell.
360
361     ?       Synonym for help.
362
363SEE ALSO
364     ftp(1), ls(1), scp(1), ssh(1), ssh-add(1), ssh-keygen(1), glob(3),
365     ssh_config(5), sftp-server(8), sshd(8)
366
367     T. Ylonen and S. Lehtinen, SSH File Transfer Protocol, draft-ietf-secsh-
368     filexfer-00.txt, January 2001, work in progress material.
369
370OpenBSD 5.5                    October 20, 2013                    OpenBSD 5.5
371