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