1 SFTP(1) OpenBSD Reference Manual SFTP(1)
4 sftp - secure file transfer program
7 sftp [-1Cv] [-B buffer_size] [-b batchfile] [-F ssh_config]
8 [-o ssh_option] [-P sftp_server_path] [-R num_requests] [-S program]
9 [-s subsystem | sftp_server] host
10 sftp [[user@]host[:file [file]]]
11 sftp [[user@]host[:dir[/]]]
12 sftp -b batchfile [user@]host
15 sftp is an interactive file transfer program, similar to ftp(1), which
16 performs all operations over an encrypted ssh(1) transport. It may also
17 use many features of ssh, such as public key authentication and compres-
18 sion. sftp connects and logs into the specified host, then enters an in-
19 teractive command mode.
21 The second usage format will retrieve files automatically if a non-inter-
22 active authentication method is used; otherwise it will do so after suc-
23 cessful interactive authentication.
25 The third usage format allows sftp to start in a remote directory.
27 The final usage format allows for automated sessions using the -b option.
28 In such cases, it is necessary to configure non-interactive authentica-
29 tion to obviate the need to enter a password at connection time (see
30 sshd(8) and ssh-keygen(1) for details). The options are as follows:
32 -1 Specify the use of protocol version 1.
35 Specify the size of the buffer that sftp uses when transferring
36 files. Larger buffers require fewer round trips at the cost of
37 higher memory consumption. The default is 32768 bytes.
40 Batch mode reads a series of commands from an input batchfile in-
41 stead of stdin. Since it lacks user interaction it should be
42 used in conjunction with non-interactive authentication. A
43 batchfile of `-' may be used to indicate standard input. sftp
44 will abort if any of the following commands fail: get, put,
45 rename, ln, rm, mkdir, chdir, ls, lchdir, chmod, chown, chgrp,
46 lpwd and lmkdir. Termination on error can be suppressed on a
47 command by command basis by prefixing the command with a `-'
48 character (for example, -rm /tmp/blah*).
50 -C Enables compression (via ssh's -C flag).
53 Specifies an alternative per-user configuration file for ssh(1).
54 This option is directly passed to ssh(1).
57 Can be used to pass options to ssh in the format used in
58 ssh_config(5). This is useful for specifying options for which
59 there is no separate sftp command-line flag. For example, to
60 specify an alternate port use: sftp -oPort=24. For full details
61 of the options listed below, and their possible values, see
67 ChallengeResponseAuthentication
79 GSSAPIDelegateCredentials
82 HostbasedAuthentication
91 NoHostAuthenticationForLocalhost
92 NumberOfPasswordPrompts
93 PasswordAuthentication
95 PreferredAuthentications
100 RhostsRSAAuthentication
106 StrictHostKeyChecking
114 Connect directly to a local sftp server (rather than via ssh(1)).
115 This option may be useful in debugging the client and server.
118 Specify how many requests may be outstanding at any one time.
119 Increasing this may slightly improve file transfer speed but will
120 increase memory usage. The default is 16 outstanding requests.
123 Name of the program to use for the encrypted connection. The
124 program must understand ssh(1) options.
126 -s subsystem | sftp_server
127 Specifies the SSH2 subsystem or the path for an sftp server on
128 the remote host. A path is useful for using sftp over protocol
129 version 1, or when the remote sshd(8) does not have an sftp sub-
132 -v Raise logging level. This option is also passed to ssh.
135 Once in interactive mode, sftp understands a set of commands similar to
136 those of ftp(1). Commands are case insensitive. Pathnames that contain
137 spaces must be enclosed in quotes. Any special characters contained
138 within pathnames that are recognized by glob(3) must be escaped with
144 Change remote directory to path.
147 Change group of file path to grp. path may contain glob(3) char-
148 acters and may match multiple files. grp must be a numeric GID.
151 Change permissions of file path to mode. path may contain
152 glob(3) characters and may match multiple files.
155 Change owner of file path to own. path may contain glob(3) char-
156 acters and may match multiple files. own must be a numeric UID.
160 get [-P] remote-path [local-path]
161 Retrieve the remote-path and store it on the local machine. If
162 the local path name is not specified, it is given the same name
163 it has on the remote machine. remote-path may contain glob(3)
164 characters and may match multiple files. If it does and local-
165 path is specified, then local-path must specify a directory. If
166 the -P flag is specified, then full file permissions and access
167 times are copied too.
169 help Display help text.
172 Change local directory to path.
174 lls [ls-options [path]]
175 Display local directory listing of either path or current direc-
176 tory if path is not specified. ls-options may contain any flags
177 supported by the local system's ls(1) command. path may contain
178 glob(3) characters and may match multiple files.
181 Create local directory specified by path.
184 Create a symbolic link from oldpath to newpath.
186 lpwd Print local working directory.
188 ls [-1aflnrSt] [path]
189 Display a remote directory listing of either path or the current
190 directory if path is not specified. path may contain glob(3)
191 characters and may match multiple files.
193 The following flags are recognized and alter the behaviour of ls
196 -1 Produce single columnar output.
198 -a List files beginning with a dot (`.').
200 -f Do not sort the listing. The default sort order is lexi-
203 -l Display additional details including permissions and own-
206 -n Produce a long listing with user and group information
207 presented numerically.
209 -r Reverse the sort order of the listing.
211 -S Sort the listing by file size.
213 -t Sort the listing by last modification time.
216 Set local umask to umask.
219 Create remote directory specified by path.
222 Toggle display of progress meter.
224 put [-P] local-path [remote-path]
225 Upload local-path and store it on the remote machine. If the re-
226 mote path name is not specified, it is given the same name it has
227 on the local machine. local-path may contain glob(3) characters
228 and may match multiple files. If it does and remote-path is
229 specified, then remote-path must specify a directory. If the -P
230 flag is specified, then the file's full permission and access
233 pwd Display remote working directory.
237 rename oldpath newpath
238 Rename remote file from oldpath to newpath.
241 Delete remote file specified by path.
244 Remove remote directory specified by path.
246 symlink oldpath newpath
247 Create a symbolic link from oldpath to newpath.
250 Display the sftp protocol version.
253 Execute command in local shell.
255 ! Escape to local shell.
260 ftp(1), ls(1), scp(1), ssh(1), ssh-add(1), ssh-keygen(1), glob(3),
261 ssh_config(5), sftp-server(8), sshd(8)
263 T. Ylonen and S. Lehtinen, SSH File Transfer Protocol, draft-ietf-secsh-
264 filexfer-00.txt, January 2001, work in progress material.
266 OpenBSD 4.1 February 4, 2001 4