1SFTP(1) BSD General Commands Manual SFTP(1)
2
4 sftp — secure file transfer program
5
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
13
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
19 interactive command mode.
20
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.
24
25 The third usage format allows sftp to start in a remote directory.
26
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:
31
32 -1 Specify the use of protocol version 1.
33
34 -B buffer_size
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.
38
39 -b batchfile
40 Batch mode reads a series of commands from an input batchfile
41 instead 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*).
49
50 -C Enables compression (via ssh's -C flag).
51
52 -F ssh_config
53 Specifies an alternative per-user configuration file for ssh(1).
54 This option is directly passed to ssh(1).
55
56 -o ssh_option
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
62 ssh_config(5).
63
64 AddressFamily
65 BatchMode
66 BindAddress
67 ChallengeResponseAuthentication
68 CheckHostIP
69 Cipher
70 Ciphers
71 Compression
72 CompressionLevel
73 ConnectionAttempts
74 ConnectTimeout
75 ControlMaster
76 ControlPath
77 GlobalKnownHostsFile
78 GSSAPIAuthentication
79 GSSAPIDelegateCredentials
80 HashKnownHosts
81 Host
82 HostbasedAuthentication
83 HostKeyAlgorithms
84 HostKeyAlias
85 HostName
86 IdentityFile
87 IdentitiesOnly
88 KbdInteractiveDevices
89 LogLevel
90 MACs
91 NoHostAuthenticationForLocalhost
92 NumberOfPasswordPrompts
93 PasswordAuthentication
94 Port
95 PreferredAuthentications
96 Protocol
97 ProxyCommand
98 PubkeyAuthentication
99 RekeyLimit
100 RhostsRSAAuthentication
101 RSAAuthentication
102 SendEnv
103 ServerAliveInterval
104 ServerAliveCountMax
105 SmartcardDevice
106 StrictHostKeyChecking
107 TCPKeepAlive
108 UsePrivilegedPort
109 User
110 UserKnownHostsFile
111 VerifyHostKeyDNS
112
113 -P sftp_server_path
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.
116
117 -R num_requests
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.
121
122 -S program
123 Name of the program to use for the encrypted connection. The
124 program must understand ssh(1) options.
125
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‐
130 system configured.
131
132 -v Raise logging level. This option is also passed to ssh.
133
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
139 backslashes (‘\’).
140
141 bye Quit sftp.
142
143 cd path
144 Change remote directory to path.
145
146 chgrp grp 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.
149
150 chmod mode path
151 Change permissions of file path to mode. path may contain
152 glob(3) characters and may match multiple files.
153
154 chown own path
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.
157
158 exit Quit sftp.
159
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
165 local-path is specified, then local-path must specify a direc‐
166 tory. If the -P flag is specified, then full file permissions
167 and access times are copied too.
168
169 help Display help text.
170
171 lcd path
172 Change local directory to path.
173
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.
179
180 lmkdir path
181 Create local directory specified by path.
182
183 ln oldpath newpath
184 Create a symbolic link from oldpath to newpath.
185
186 lpwd Print local working directory.
187
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.
192
193 The following flags are recognized and alter the behaviour of ls
194 accordingly:
195
196 -1 Produce single columnar output.
197
198 -a List files beginning with a dot (‘.’).
199
200 -f Do not sort the listing. The default sort order is lexi‐
201 cographical.
202
203 -l Display additional details including permissions and own‐
204 ership information.
205
206 -n Produce a long listing with user and group information
207 presented numerically.
208
209 -r Reverse the sort order of the listing.
210
211 -S Sort the listing by file size.
212
213 -t Sort the listing by last modification time.
214
215 lumask umask
216 Set local umask to umask.
217
218 mkdir path
219 Create remote directory specified by path.
220
221 progress
222 Toggle display of progress meter.
223
224 put [-P] local-path [remote-path]
225 Upload local-path and store it on the remote machine. If the
226 remote path name is not specified, it is given the same name it
227 has on the local machine. local-path may contain glob(3) charac‐
228 ters 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
231 time are copied too.
232
233 pwd Display remote working directory.
234
235 quit Quit sftp.
236
237 rename oldpath newpath
238 Rename remote file from oldpath to newpath.
239
240 rm path
241 Delete remote file specified by path.
242
243 rmdir path
244 Remove remote directory specified by path.
245
246 symlink oldpath newpath
247 Create a symbolic link from oldpath to newpath.
248
249 version
250 Display the sftp protocol version.
251
252 ! command
253 Execute command in local shell.
254
255 ! Escape to local shell.
256
257 ? Synonym for help.
258
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)
262
263 T. Ylonen and S. Lehtinen, SSH File Transfer Protocol, draft-ietf-secsh-
264 filexfer-00.txt, January 2001, work in progress material.
265
266BSD February 4, 2001 BSD