1 SFTP(1) OpenBSD Reference Manual SFTP(1)
4 sftp - secure file transfer program
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
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.
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.
26 The third usage format allows sftp to start in a remote directory.
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:
33 -1 Specify the use of protocol version 1.
35 -2 Specify the use of protocol version 2.
37 -4 Forces sftp to use IPv4 addresses only.
39 -6 Forces sftp to use IPv6 addresses only.
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.
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*).
57 -C Enables compression (via ssh's -C flag).
60 Selects the cipher to use for encrypting the data transfers.
61 This option is directly passed to ssh(1).
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.
68 Specifies an alternative per-user configuration file for ssh(1).
69 This option is directly passed to ssh(1).
72 Selects the file from which the identity (private key) for public
73 key authentication is read. This option is directly passed to
77 Limits the used bandwidth, specified in Kbit/s.
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
90 ChallengeResponseAuthentication
102 GSSAPIDelegateCredentials
105 HostbasedAuthentication
112 KbdInteractiveDevices
116 NoHostAuthenticationForLocalhost
117 NumberOfPasswordPrompts
118 PasswordAuthentication
121 PreferredAuthentications
126 RhostsRSAAuthentication
131 StrictHostKeyChecking
139 Specifies the port to connect to on the remote host.
141 -p Preserves modification times, access times, and modes from the
142 original files transferred.
144 -q Quiet mode: disables the progress meter as well as warning and
145 diagnostic messages from ssh(1).
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.
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.
157 Name of the program to use for the encrypted connection. The
158 program must understand ssh(1) options.
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.
166 -v Raise logging level. This option is also passed to ssh.
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
178 Change remote directory to 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
186 Change permissions of file path to mode. path may contain
187 glob(3) characters and may match multiple files.
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
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.
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
212 If either the -P or -p flag is specified, then full file
213 permissions and access times are copied too.
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.
219 help Display help text.
222 Change local directory to path.
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.
231 Create local directory specified by path.
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
238 lpwd Print local working directory.
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.
245 The following flags are recognized and alter the behaviour of ls
248 -1 Produce single columnar output.
250 -a List files beginning with a dot (`.').
252 -f Do not sort the listing. The default sort order is
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,
261 -l Display additional details including permissions and
262 ownership information.
264 -n Produce a long listing with user and group information
265 presented numerically.
267 -r Reverse the sort order of the listing.
269 -S Sort the listing by file size.
271 -t Sort the listing by last modification time.
274 Set local umask to umask.
277 Create remote directory specified by path.
280 Toggle display of progress meter.
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
290 If ether the -P or -p flag is specified, then full file
291 permissions and access times are copied too.
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.
297 pwd Display remote working directory.
301 rename oldpath newpath
302 Rename remote file from oldpath to newpath.
305 Delete remote file specified by path.
308 Remove remote directory specified by path.
310 symlink oldpath newpath
311 Create a symbolic link from oldpath to newpath.
314 Display the sftp protocol version.
317 Execute command in local shell.
319 ! Escape to local shell.
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)
327 T. Ylonen and S. Lehtinen, SSH File Transfer Protocol,
328 draft-ietf-secsh-filexfer-00.txt, January 2001, work in progress
331 OpenBSD 4.9 December 4, 2010 OpenBSD 4.9