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