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