sftp.0 revision 225825
1160814SsimonSFTP(1)                    OpenBSD Reference Manual                    SFTP(1)
2280304Sjkim
3280304SjkimNAME
4280304Sjkim     sftp - secure file transfer program
5280304Sjkim
6160814SsimonSYNOPSIS
7160814Ssimon     sftp [-1246Cpqrv] [-B buffer_size] [-b batchfile] [-c cipher]
8160814Ssimon          [-D sftp_server_path] [-F ssh_config] [-i identity_file] [-l limit]
9160814Ssimon          [-o ssh_option] [-P port] [-R num_requests] [-S program]
10160814Ssimon          [-s subsystem | sftp_server] host
11160814Ssimon     sftp [user@]host[:file ...]
12160814Ssimon     sftp [user@]host[:dir[/]]
13160814Ssimon     sftp -b batchfile [user@]host
14160814Ssimon
15280304SjkimDESCRIPTION
16160814Ssimon     sftp is an interactive file transfer program, similar to ftp(1), which
17160814Ssimon     performs all operations over an encrypted ssh(1) transport.  It may also
18160814Ssimon     use many features of ssh, such as public key authentication and
19160814Ssimon     compression.  sftp connects and logs into the specified host, then enters
20160814Ssimon     an interactive command mode.
21160814Ssimon
22160814Ssimon     The second usage format will retrieve files automatically if a non-
23160814Ssimon     interactive authentication method is used; otherwise it will do so after
24160814Ssimon     successful interactive authentication.
25160814Ssimon
26160814Ssimon     The third usage format allows sftp to start in a remote directory.
27160814Ssimon
28160814Ssimon     The final usage format allows for automated sessions using the -b option.
29160814Ssimon     In such cases, it is necessary to configure non-interactive
30160814Ssimon     authentication to obviate the need to enter a password at connection time
31160814Ssimon     (see sshd(8) and ssh-keygen(1) for details).
32160814Ssimon
33160814Ssimon     Since some usage formats use colon characters to delimit host names from
34160814Ssimon     path names, IPv6 addresses must be enclosed in square brackets to avoid
35160814Ssimon     ambiguity.
36160814Ssimon
37160814Ssimon     The options are as follows:
38160814Ssimon
39160814Ssimon     -1      Specify the use of protocol version 1.
40160814Ssimon
41160814Ssimon     -2      Specify the use of protocol version 2.
42160814Ssimon
43160814Ssimon     -4      Forces sftp to use IPv4 addresses only.
44160814Ssimon
45160814Ssimon     -6      Forces sftp to use IPv6 addresses only.
46160814Ssimon
47160814Ssimon     -B buffer_size
48160814Ssimon             Specify the size of the buffer that sftp uses when transferring
49160814Ssimon             files.  Larger buffers require fewer round trips at the cost of
50160814Ssimon             higher memory consumption.  The default is 32768 bytes.
51160814Ssimon
52160814Ssimon     -b batchfile
53160814Ssimon             Batch mode reads a series of commands from an input batchfile
54160814Ssimon             instead of stdin.  Since it lacks user interaction it should be
55160814Ssimon             used in conjunction with non-interactive authentication.  A
56160814Ssimon             batchfile of `-' may be used to indicate standard input.  sftp
57160814Ssimon             will abort if any of the following commands fail: get, put,
58160814Ssimon             rename, ln, rm, mkdir, chdir, ls, lchdir, chmod, chown, chgrp,
59160814Ssimon             lpwd, df, symlink, and lmkdir.  Termination on error can be
60160814Ssimon             suppressed on a command by command basis by prefixing the command
61160814Ssimon             with a `-' character (for example, -rm /tmp/blah*).
62160814Ssimon
63160814Ssimon     -C      Enables compression (via ssh's -C flag).
64160814Ssimon
65160814Ssimon     -c cipher
66160814Ssimon             Selects the cipher to use for encrypting the data transfers.
67160814Ssimon             This option is directly passed to ssh(1).
68160814Ssimon
69160814Ssimon     -D sftp_server_path
70280304Sjkim             Connect directly to a local sftp server (rather than via ssh(1)).
71160814Ssimon             This option may be useful in debugging the client and server.
72160814Ssimon
73280304Sjkim     -F ssh_config
74160814Ssimon             Specifies an alternative per-user configuration file for ssh(1).
75160814Ssimon             This option is directly passed to ssh(1).
76160814Ssimon
77160814Ssimon     -i identity_file
78280304Sjkim             Selects the file from which the identity (private key) for public
79160814Ssimon             key authentication is read.  This option is directly passed to
80280304Sjkim             ssh(1).
81280304Sjkim
82160814Ssimon     -l limit
83160814Ssimon             Limits the used bandwidth, specified in Kbit/s.
84160814Ssimon
85160814Ssimon     -o ssh_option
86160814Ssimon             Can be used to pass options to ssh in the format used in
87160814Ssimon             ssh_config(5).  This is useful for specifying options for which
88160814Ssimon             there is no separate sftp command-line flag.  For example, to
89280304Sjkim             specify an alternate port use: sftp -oPort=24.  For full details
90280304Sjkim             of the options listed below, and their possible values, see
91280304Sjkim             ssh_config(5).
92280304Sjkim
93280304Sjkim                   AddressFamily
94160814Ssimon                   BatchMode
95280304Sjkim                   BindAddress
96280304Sjkim                   ChallengeResponseAuthentication
97160814Ssimon                   CheckHostIP
98160814Ssimon                   Cipher
99160814Ssimon                   Ciphers
100160814Ssimon                   Compression
101280304Sjkim                   CompressionLevel
102160814Ssimon                   ConnectionAttempts
103160814Ssimon                   ConnectTimeout
104280304Sjkim                   ControlMaster
105280304Sjkim                   ControlPath
106280304Sjkim                   GlobalKnownHostsFile
107280304Sjkim                   GSSAPIAuthentication
108280304Sjkim                   GSSAPIDelegateCredentials
109160814Ssimon                   HashKnownHosts
110160814Ssimon                   Host
111160814Ssimon                   HostbasedAuthentication
112280304Sjkim                   HostKeyAlgorithms
113160814Ssimon                   HostKeyAlias
114280304Sjkim                   HostName
115160814Ssimon                   IdentityFile
116280304Sjkim                   IdentitiesOnly
117280304Sjkim                   IPQoS
118160814Ssimon                   KbdInteractiveDevices
119160814Ssimon                   KexAlgorithms
120280304Sjkim                   LogLevel
121280304Sjkim                   MACs
122215697Ssimon                   NoHostAuthenticationForLocalhost
123280304Sjkim                   NumberOfPasswordPrompts
124160814Ssimon                   PasswordAuthentication
125280304Sjkim                   PKCS11Provider
126160814Ssimon                   Port
127160814Ssimon                   PreferredAuthentications
128160814Ssimon                   Protocol
129280304Sjkim                   ProxyCommand
130280304Sjkim                   PubkeyAuthentication
131280304Sjkim                   RekeyLimit
132280304Sjkim                   RhostsRSAAuthentication
133160814Ssimon                   RSAAuthentication
134160814Ssimon                   SendEnv
135160814Ssimon                   ServerAliveInterval
136160814Ssimon                   ServerAliveCountMax
137160814Ssimon                   StrictHostKeyChecking
138160814Ssimon                   TCPKeepAlive
139160814Ssimon                   UsePrivilegedPort
140280304Sjkim                   User
141280304Sjkim                   UserKnownHostsFile
142160814Ssimon                   VerifyHostKeyDNS
143280304Sjkim
144280304Sjkim     -P port
145160814Ssimon             Specifies the port to connect to on the remote host.
146160814Ssimon
147160814Ssimon     -p      Preserves modification times, access times, and modes from the
148280304Sjkim             original files transferred.
149280304Sjkim
150280304Sjkim     -q      Quiet mode: disables the progress meter as well as warning and
151160814Ssimon             diagnostic messages from ssh(1).
152280304Sjkim
153280304Sjkim     -R num_requests
154280304Sjkim             Specify how many requests may be outstanding at any one time.
155160814Ssimon             Increasing this may slightly improve file transfer speed but will
156160814Ssimon             increase memory usage.  The default is 64 outstanding requests.
157160814Ssimon
158280304Sjkim     -r      Recursively copy entire directories when uploading and
159280304Sjkim             downloading.  Note that sftp does not follow symbolic links
160280304Sjkim             encountered in the tree traversal.
161280304Sjkim
162280304Sjkim     -S program
163160814Ssimon             Name of the program to use for the encrypted connection.  The
164280304Sjkim             program must understand ssh(1) options.
165280304Sjkim
166280304Sjkim     -s subsystem | sftp_server
167280304Sjkim             Specifies the SSH2 subsystem or the path for an sftp server on
168280304Sjkim             the remote host.  A path is useful for using sftp over protocol
169280304Sjkim             version 1, or when the remote sshd(8) does not have an sftp
170280304Sjkim             subsystem configured.
171280304Sjkim
172280304Sjkim     -v      Raise logging level.  This option is also passed to ssh.
173280304Sjkim
174280304SjkimINTERACTIVE COMMANDS
175280304Sjkim     Once in interactive mode, sftp understands a set of commands similar to
176280304Sjkim     those of ftp(1).  Commands are case insensitive.  Pathnames that contain
177280304Sjkim     spaces must be enclosed in quotes.  Any special characters contained
178280304Sjkim     within pathnames that are recognized by glob(3) must be escaped with
179280304Sjkim     backslashes (`\').
180280304Sjkim
181280304Sjkim     bye     Quit sftp.
182280304Sjkim
183280304Sjkim     cd path
184280304Sjkim             Change remote directory to path.
185280304Sjkim
186160814Ssimon     chgrp grp path
187280304Sjkim             Change group of file path to grp.  path may contain glob(3)
188160814Ssimon             characters and may match multiple files.  grp must be a numeric
189280304Sjkim             GID.
190280304Sjkim
191280304Sjkim     chmod mode path
192280304Sjkim             Change permissions of file path to mode.  path may contain
193280304Sjkim             glob(3) characters and may match multiple files.
194280304Sjkim
195280304Sjkim     chown own path
196280304Sjkim             Change owner of file path to own.  path may contain glob(3)
197280304Sjkim             characters and may match multiple files.  own must be a numeric
198280304Sjkim             UID.
199280304Sjkim
200280304Sjkim     df [-hi] [path]
201280304Sjkim             Display usage information for the filesystem holding the current
202280304Sjkim             directory (or path if specified).  If the -h flag is specified,
203280304Sjkim             the capacity information will be displayed using "human-readable"
204280304Sjkim             suffixes.  The -i flag requests display of inode information in
205280304Sjkim             addition to capacity information.  This command is only supported
206160814Ssimon             on servers that implement the ``statvfs@openssh.com'' extension.
207280304Sjkim
208160814Ssimon     exit    Quit sftp.
209280304Sjkim
210280304Sjkim     get [-Ppr] remote-path [local-path]
211280304Sjkim             Retrieve the remote-path and store it on the local machine.  If
212280304Sjkim             the local path name is not specified, it is given the same name
213280304Sjkim             it has on the remote machine.  remote-path may contain glob(3)
214280304Sjkim             characters and may match multiple files.  If it does and
215280304Sjkim             local-path is specified, then local-path must specify a
216280304Sjkim             directory.
217280304Sjkim
218280304Sjkim             If either the -P or -p flag is specified, then full file
219280304Sjkim             permissions and access times are copied too.
220280304Sjkim
221160814Ssimon             If the -r flag is specified then directories will be copied
222280304Sjkim             recursively.  Note that sftp does not follow symbolic links when
223280304Sjkim             performing recursive transfers.
224280304Sjkim
225280304Sjkim     help    Display help text.
226280304Sjkim
227280304Sjkim     lcd path
228280304Sjkim             Change local directory to path.
229280304Sjkim
230280304Sjkim     lls [ls-options [path]]
231160814Ssimon             Display local directory listing of either path or current
232160814Ssimon             directory if path is not specified.  ls-options may contain any
233160814Ssimon             flags supported by the local system's ls(1) command.  path may
234160814Ssimon             contain glob(3) characters and may match multiple files.
235280304Sjkim
236160814Ssimon     lmkdir path
237160814Ssimon             Create local directory specified by path.
238280304Sjkim
239160814Ssimon     ln [-s] oldpath newpath
240160814Ssimon             Create a link from oldpath to newpath.  If the -s flag is
241160814Ssimon             specified the created link is a symbolic link, otherwise it is a
242160814Ssimon             hard link.
243280304Sjkim
244280304Sjkim     lpwd    Print local working directory.
245280304Sjkim
246280304Sjkim     ls [-1afhlnrSt] [path]
247280304Sjkim             Display a remote directory listing of either path or the current
248280304Sjkim             directory if path is not specified.  path may contain glob(3)
249280304Sjkim             characters and may match multiple files.
250160814Ssimon
251280304Sjkim             The following flags are recognized and alter the behaviour of ls
252280304Sjkim             accordingly:
253280304Sjkim
254280304Sjkim             -1      Produce single columnar output.
255280304Sjkim
256280304Sjkim             -a      List files beginning with a dot (`.').
257280304Sjkim
258280304Sjkim             -f      Do not sort the listing.  The default sort order is
259160814Ssimon                     lexicographical.
260280304Sjkim
261280304Sjkim             -h      When used with a long format option, use unit suffixes:
262280304Sjkim                     Byte, Kilobyte, Megabyte, Gigabyte, Terabyte, Petabyte,
263280304Sjkim                     and Exabyte in order to reduce the number of digits to
264280304Sjkim                     four or fewer using powers of 2 for sizes (K=1024,
265280304Sjkim                     M=1048576, etc.).
266280304Sjkim
267280304Sjkim             -l      Display additional details including permissions and
268280304Sjkim                     ownership information.
269280304Sjkim
270160814Ssimon             -n      Produce a long listing with user and group information
271280304Sjkim                     presented numerically.
272280304Sjkim
273280304Sjkim             -r      Reverse the sort order of the listing.
274280304Sjkim
275280304Sjkim             -S      Sort the listing by file size.
276160814Ssimon
277280304Sjkim             -t      Sort the listing by last modification time.
278160814Ssimon
279160814Ssimon     lumask umask
280160814Ssimon             Set local umask to umask.
281160814Ssimon
282160814Ssimon     mkdir path
283280304Sjkim             Create remote directory specified by path.
284280304Sjkim
285280304Sjkim     progress
286280304Sjkim             Toggle display of progress meter.
287280304Sjkim
288280304Sjkim     put [-Ppr] local-path [remote-path]
289280304Sjkim             Upload local-path and store it on the remote machine.  If the
290280304Sjkim             remote path name is not specified, it is given the same name it
291280304Sjkim             has on the local machine.  local-path may contain glob(3)
292280304Sjkim             characters and may match multiple files.  If it does and
293280304Sjkim             remote-path is specified, then remote-path must specify a
294280304Sjkim             directory.
295280304Sjkim
296280304Sjkim             If either the -P or -p flag is specified, then full file
297280304Sjkim             permissions and access times are copied too.
298280304Sjkim
299160814Ssimon             If the -r flag is specified then directories will be copied
300160814Ssimon             recursively.  Note that sftp does not follow symbolic links when
301160814Ssimon             performing recursive transfers.
302160814Ssimon
303280304Sjkim     pwd     Display remote working directory.
304280304Sjkim
305280304Sjkim     quit    Quit sftp.
306280304Sjkim
307280304Sjkim     rename oldpath newpath
308280304Sjkim             Rename remote file from oldpath to newpath.
309280304Sjkim
310160814Ssimon     rm path
311280304Sjkim             Delete remote file specified by path.
312280304Sjkim
313280304Sjkim     rmdir path
314280304Sjkim             Remove remote directory specified by path.
315280304Sjkim
316280304Sjkim     symlink oldpath newpath
317280304Sjkim             Create a symbolic link from oldpath to newpath.
318280304Sjkim
319280304Sjkim     version
320280304Sjkim             Display the sftp protocol version.
321280304Sjkim
322280304Sjkim     !command
323280304Sjkim             Execute command in local shell.
324280304Sjkim
325160814Ssimon     !       Escape to local shell.
326280304Sjkim
327280304Sjkim     ?       Synonym for help.
328280304Sjkim
329280304SjkimSEE ALSO
330280304Sjkim     ftp(1), ls(1), scp(1), ssh(1), ssh-add(1), ssh-keygen(1), glob(3),
331280304Sjkim     ssh_config(5), sftp-server(8), sshd(8)
332280304Sjkim
333280304Sjkim     T. Ylonen and S. Lehtinen, SSH File Transfer Protocol,
334280304Sjkim     draft-ietf-secsh-filexfer-00.txt, January 2001, work in progress
335280304Sjkim     material.
336280304Sjkim
337280304SjkimOpenBSD 5.0                     August 7, 2011                     OpenBSD 5.0
338280304Sjkim