]> andersk Git - openssh.git/blame - sftp.1
- djm@cvs.openbsd.org 2010/01/30 02:54:53
[openssh.git] / sftp.1
CommitLineData
69098855 1.\" $OpenBSD: sftp.1,v 1.82 2010/01/13 12:48:34 jmc Exp $
61e96248 2.\"
f3c7c613 3.\" Copyright (c) 2001 Damien Miller. All rights reserved.
61e96248 4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\" notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\" notice, this list of conditions and the following disclaimer in the
12.\" documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24.\"
e473dcd1 25.Dd $Mdocdate$
61e96248 26.Dt SFTP 1
27.Os
28.Sh NAME
29.Nm sftp
bd47824b 30.Nd secure file transfer program
61e96248 31.Sh SYNOPSIS
72c5fe79 32.Nm sftp
a4e5acef 33.Bk -words
d141f964 34.Op Fl 1246Cpqrv
7d5e8c46 35.Op Fl B Ar buffer_size
433e60ac 36.Op Fl b Ar batchfile
3496b8d4 37.Op Fl c Ar cipher
97658f13 38.Op Fl D Ar sftp_server_path
7d5e8c46 39.Op Fl F Ar ssh_config
5aa0f160 40.Op Fl i Ar identity_file
433e60ac 41.Op Fl o Ar ssh_option
97658f13 42.Op Fl P Ar port
c25d3df7 43.Op Fl R Ar num_requests
e3c1c3e6 44.Op Fl S Ar program
433e60ac 45.Op Fl s Ar subsystem | sftp_server
e3c1c3e6 46.Ar host
a4e5acef 47.Ek
72c5fe79 48.Nm sftp
83cd8c39 49.Oo Ar user Ns @ Oc Ns
50.Ar host Ns Op : Ns Ar
72c5fe79 51.Nm sftp
83cd8c39 52.Oo Ar user Ns @ Oc Ns
a4e5acef 53.Ar host Ns Oo : Ns Ar dir Ns
d3cd4016 54.Op Ar / Oc
72c5fe79 55.Nm sftp
81466908 56.Fl b Ar batchfile
d0445371 57.Oo Ar user Ns @ Oc Ns Ar host
61e96248 58.Sh DESCRIPTION
59.Nm
60is an interactive file transfer program, similar to
61.Xr ftp 1 ,
62which performs all operations over an encrypted
63.Xr ssh 1
64transport.
65It may also use many features of ssh, such as public key authentication and
66compression.
67.Nm
68connects and logs into the specified
cf7ff074 69.Ar host ,
61e96248 70then enters an interactive command mode.
71.Pp
3730bb22 72The second usage format will retrieve files automatically if a non-interactive
cf7ff074 73authentication method is used; otherwise it will do so after
74successful interactive authentication.
edeeab1e 75.Pp
f9d52dd1 76The third usage format allows
77.Nm
78to start in a remote directory.
edeeab1e 79.Pp
bd47824b 80The final usage format allows for automated sessions using the
81466908 81.Fl b
bd47824b 82option.
3da242db 83In such cases, it is necessary to configure non-interactive authentication
bd47824b 84to obviate the need to enter a password at connection time (see
81466908 85.Xr sshd 8
72c5fe79 86and
81466908 87.Xr ssh-keygen 1
bd47824b 88for details).
61e96248 89The options are as follows:
90.Bl -tag -width Ds
433e60ac 91.It Fl 1
92Specify the use of protocol version 1.
3496b8d4 93.It Fl 2
94Specify the use of protocol version 2.
95.It Fl 4
96Forces
97.Nm
98to use IPv4 addresses only.
99.It Fl 6
100Forces
101.Nm
102to use IPv6 addresses only.
433e60ac 103.It Fl B Ar buffer_size
104Specify the size of the buffer that
105.Nm
106uses when transferring files.
107Larger buffers require fewer round trips at the cost of higher
108memory consumption.
109The default is 32768 bytes.
a5ec8a3d 110.It Fl b Ar batchfile
111Batch mode reads a series of commands from an input
acf06a60 112.Ar batchfile
a5ec8a3d 113instead of
acf06a60 114.Em stdin .
115Since it lacks user interaction it should be used in conjunction with
f74de0d7 116non-interactive authentication.
a8b64bb8 117A
f74de0d7 118.Ar batchfile
119of
120.Sq \-
a8b64bb8 121may be used to indicate standard input.
acf06a60 122.Nm
3730bb22 123will abort if any of the following
124commands fail:
7e35f994 125.Ic get , put , rename , ln ,
a4e5acef 126.Ic rm , mkdir , chdir , ls ,
ea530517 127.Ic lchdir , chmod , chown ,
128.Ic chgrp , lpwd , df ,
a5ec8a3d 129and
acf06a60 130.Ic lmkdir .
a4e5acef 131Termination on error can be suppressed on a command by command basis by
132prefixing the command with a
f74de0d7 133.Sq \-
bd47824b 134character (for example,
135.Ic -rm /tmp/blah* ) .
433e60ac 136.It Fl C
137Enables compression (via ssh's
138.Fl C
139flag).
b68241c3 140.It Fl c Ar cipher
141Selects the cipher to use for encrypting the data transfers.
142This option is directly passed to
143.Xr ssh 1 .
97658f13 144.It Fl D Ar sftp_server_path
145Connect directly to a local sftp server
146(rather than via
147.Xr ssh 1 ) .
148This option may be useful in debugging the client and server.
433e60ac 149.It Fl F Ar ssh_config
150Specifies an alternative
151per-user configuration file for
152.Xr ssh 1 .
153This option is directly passed to
154.Xr ssh 1 .
3496b8d4 155.It Fl i Ar identity_file
156Selects the file from which the identity (private key) for public key
157authentication is read.
158This option is directly passed to
159.Xr ssh 1 .
61e96248 160.It Fl o Ar ssh_option
38539909 161Can be used to pass options to
162.Nm ssh
c21a7c4a 163in the format used in
164.Xr ssh_config 5 .
165This is useful for specifying options
38539909 166for which there is no separate
167.Nm sftp
bd47824b 168command-line flag.
169For example, to specify an alternate port use:
e3c1c3e6 170.Ic sftp -oPort=24 .
433e60ac 171For full details of the options listed below, and their possible values, see
172.Xr ssh_config 5 .
173.Pp
174.Bl -tag -width Ds -offset indent -compact
175.It AddressFamily
176.It BatchMode
177.It BindAddress
178.It ChallengeResponseAuthentication
179.It CheckHostIP
180.It Cipher
181.It Ciphers
433e60ac 182.It Compression
183.It CompressionLevel
184.It ConnectionAttempts
927fcba2 185.It ConnectTimeout
5e96b616 186.It ControlMaster
187.It ControlPath
433e60ac 188.It GlobalKnownHostsFile
189.It GSSAPIAuthentication
190.It GSSAPIDelegateCredentials
ba9d1100 191.It HashKnownHosts
433e60ac 192.It Host
193.It HostbasedAuthentication
194.It HostKeyAlgorithms
195.It HostKeyAlias
196.It HostName
197.It IdentityFile
3a065ed0 198.It IdentitiesOnly
396070f8 199.It KbdInteractiveDevices
433e60ac 200.It LogLevel
201.It MACs
202.It NoHostAuthenticationForLocalhost
203.It NumberOfPasswordPrompts
204.It PasswordAuthentication
205.It Port
206.It PreferredAuthentications
207.It Protocol
208.It ProxyCommand
209.It PubkeyAuthentication
db175906 210.It RekeyLimit
433e60ac 211.It RhostsRSAAuthentication
212.It RSAAuthentication
8e99a198 213.It SendEnv
5d8d32a3 214.It ServerAliveInterval
215.It ServerAliveCountMax
433e60ac 216.It SmartcardDevice
217.It StrictHostKeyChecking
fd573618 218.It TCPKeepAlive
433e60ac 219.It UsePrivilegedPort
220.It User
221.It UserKnownHostsFile
222.It VerifyHostKeyDNS
433e60ac 223.El
97658f13 224.It Fl P Ar port
225Specifies the port to connect to on the remote host.
d141f964 226.It Fl p
227Preserves modification times, access times, and modes from the
228original files transferred.
3496b8d4 229.It Fl q
230Quiet mode: disables the progress meter as well as warning and
231diagnostic messages from
232.Xr ssh 1 .
c25d3df7 233.It Fl R Ar num_requests
bd47824b 234Specify how many requests may be outstanding at any one time.
235Increasing this may slightly improve file transfer speed
236but will increase memory usage.
b8c9ea19 237The default is 64 outstanding requests.
d141f964 238.It Fl r
239Recursively copy entire directories when uploading and downloading.
240Note that
241.Nm
242does not follow symbolic links encountered in the tree traversal.
e3c1c3e6 243.It Fl S Ar program
244Name of the
245.Ar program
246to use for the encrypted connection.
247The program must understand
248.Xr ssh 1
249options.
433e60ac 250.It Fl s Ar subsystem | sftp_server
251Specifies the SSH2 subsystem or the path for an sftp server
252on the remote host.
253A path is useful for using
254.Nm
255over protocol version 1, or when the remote
256.Xr sshd 8
257does not have an sftp subsystem configured.
258.It Fl v
259Raise logging level.
260This option is also passed to ssh.
61e96248 261.El
262.Sh INTERACTIVE COMMANDS
0426a3b4 263Once in interactive mode,
264.Nm
3730bb22 265understands a set of commands similar to those of
61e96248 266.Xr ftp 1 .
f9d52dd1 267Commands are case insensitive.
268Pathnames that contain spaces must be enclosed in quotes.
269Any special characters contained within pathnames that are recognized by
270.Xr glob 3
271must be escaped with backslashes
272.Pq Sq \e .
273.Bl -tag -width Ds
68874d2b 274.It Ic bye
bd47824b 275Quit
276.Nm sftp .
0426a3b4 277.It Ic cd Ar path
3730bb22 278Change remote directory to
0426a3b4 279.Ar path .
0426a3b4 280.It Ic chgrp Ar grp Ar path
3730bb22 281Change group of file
0426a3b4 282.Ar path
283to
61e96248 284.Ar grp .
f9d52dd1 285.Ar path
286may contain
287.Xr glob 3
288characters and may match multiple files.
61e96248 289.Ar grp
0426a3b4 290must be a numeric GID.
291.It Ic chmod Ar mode Ar path
3730bb22 292Change permissions of file
0426a3b4 293.Ar path
294to
295.Ar mode .
f9d52dd1 296.Ar path
297may contain
298.Xr glob 3
299characters and may match multiple files.
0426a3b4 300.It Ic chown Ar own Ar path
3730bb22 301Change owner of file
0426a3b4 302.Ar path
303to
61e96248 304.Ar own .
f9d52dd1 305.Ar path
306may contain
307.Xr glob 3
308characters and may match multiple files.
61e96248 309.Ar own
310must be a numeric UID.
360b43ab 311.It Xo Ic df
312.Op Fl hi
313.Op Ar path
314.Xc
315Display usage information for the filesystem holding the current directory
316(or
317.Ar path
318if specified).
319If the
320.Fl h
321flag is specified, the capacity information will be displayed using
322"human-readable" suffixes.
323The
324.Fl i
325flag requests display of inode information in addition to capacity information.
326This command is only supported on servers that implement the
327.Dq statvfs@openssh.com
328extension.
17910dce 329.It Ic exit
bd47824b 330Quit
331.Nm sftp .
58c54a79 332.It Xo Ic get
d141f964 333.Op Fl Ppr
58c54a79 334.Ar remote-path
335.Op Ar local-path
336.Xc
61e96248 337Retrieve the
0426a3b4 338.Ar remote-path
61e96248 339and store it on the local machine.
340If the local
3730bb22 341path name is not specified, it is given the same name it has on the
bd47824b 342remote machine.
f9d52dd1 343.Ar remote-path
344may contain
345.Xr glob 3
346characters and may match multiple files.
347If it does and
348.Ar local-path
349is specified, then
350.Ar local-path
351must specify a directory.
d141f964 352.Pp
3829cbca 353If either the
e83f55f9 354.Fl P
d141f964 355or
356.Fl p
f9d52dd1 357flag is specified, then full file permissions and access times are
58c54a79 358copied too.
d141f964 359.Pp
360If the
361.Fl r
362flag is specified then directories will be copied recursively.
363Note that
364.Nm
365does not follow symbolic links when performing recursive transfers.
17910dce 366.It Ic help
367Display help text.
433e60ac 368.It Ic lcd Ar path
369Change local directory to
370.Ar path .
0426a3b4 371.It Ic lls Op Ar ls-options Op Ar path
3730bb22 372Display local directory listing of either
61e96248 373.Ar path
374or current directory if
375.Ar path
0426a3b4 376is not specified.
f9d52dd1 377.Ar ls-options
378may contain any flags supported by the local system's
379.Xr ls 1
380command.
381.Ar path
382may contain
383.Xr glob 3
384characters and may match multiple files.
0426a3b4 385.It Ic lmkdir Ar path
61e96248 386Create local directory specified by
0426a3b4 387.Ar path .
3a7fe5ba 388.It Ic ln Ar oldpath Ar newpath
3730bb22 389Create a symbolic link from
3a7fe5ba 390.Ar oldpath
391to
392.Ar newpath .
0426a3b4 393.It Ic lpwd
394Print local working directory.
00b3ad3e 395.It Xo Ic ls
69098855 396.Op Fl 1afhlnrSt
00b3ad3e 397.Op Ar path
398.Xc
f9d52dd1 399Display a remote directory listing of either
61e96248 400.Ar path
f9d52dd1 401or the current directory if
0426a3b4 402.Ar path
bd47824b 403is not specified.
f9d52dd1 404.Ar path
405may contain
406.Xr glob 3
407characters and may match multiple files.
c4c84934 408.Pp
f9d52dd1 409The following flags are recognized and alter the behaviour of
c4c84934 410.Ic ls
f9d52dd1 411accordingly:
412.Bl -tag -width Ds
413.It Fl 1
414Produce single columnar output.
415.It Fl a
416List files beginning with a dot
417.Pq Sq \&. .
418.It Fl f
419Do not sort the listing.
420The default sort order is lexicographical.
29793ade 421.It Fl h
422When used with a long format option, use unit suffixes: Byte, Kilobyte,
423Megabyte, Gigabyte, Terabyte, Petabyte, and Exabyte in order to reduce
424the number of digits to four or fewer using powers of 2 for sizes (K=1024,
425M=1048576, etc.).
69098855 426.It Fl l
427Display additional details including permissions
428and ownership information.
f9d52dd1 429.It Fl n
430Produce a long listing with user and group information presented
431numerically.
432.It Fl r
433Reverse the sort order of the listing.
434.It Fl S
435Sort the listing by file size.
436.It Fl t
437Sort the listing by last modification time.
438.El
0426a3b4 439.It Ic lumask Ar umask
3730bb22 440Set local umask to
0426a3b4 441.Ar umask .
442.It Ic mkdir Ar path
61e96248 443Create remote directory specified by
0426a3b4 444.Ar path .
b65c3807 445.It Ic progress
446Toggle display of progress meter.
58c54a79 447.It Xo Ic put
e83f55f9 448.Op Fl Ppr
58c54a79 449.Ar local-path
2ea16b0b 450.Op Ar remote-path
58c54a79 451.Xc
61e96248 452Upload
0426a3b4 453.Ar local-path
bd47824b 454and store it on the remote machine.
455If the remote path name is not specified, it is given the same name it has
456on the local machine.
f9d52dd1 457.Ar local-path
458may contain
459.Xr glob 3
460characters and may match multiple files.
461If it does and
462.Ar remote-path
463is specified, then
464.Ar remote-path
465must specify a directory.
d141f964 466.Pp
467If ether the
58c54a79 468.Fl P
d141f964 469or
470.Fl p
471flag is specified, then full file permissions and access times are
58c54a79 472copied too.
d141f964 473.Pp
474If the
475.Fl r
476flag is specified then directories will be copied recursively.
477Note that
478.Nm
479does not follow symbolic links when performing recursive transfers.
0426a3b4 480.It Ic pwd
481Display remote working directory.
0426a3b4 482.It Ic quit
bd47824b 483Quit
484.Nm sftp .
0426a3b4 485.It Ic rename Ar oldpath Ar newpath
61e96248 486Rename remote file from
487.Ar oldpath
488to
0426a3b4 489.Ar newpath .
0426a3b4 490.It Ic rm Ar path
61e96248 491Delete remote file specified by
0426a3b4 492.Ar path .
433e60ac 493.It Ic rmdir Ar path
494Remove remote directory specified by
495.Ar path .
3a7fe5ba 496.It Ic symlink Ar oldpath Ar newpath
3730bb22 497Create a symbolic link from
3a7fe5ba 498.Ar oldpath
499to
500.Ar newpath .
048ff12c 501.It Ic version
502Display the
503.Nm
504protocol version.
d3cd4016 505.It Ic \&! Ns Ar command
3730bb22 506Execute
61e96248 507.Ar command
0426a3b4 508in local shell.
d0445371 509.It Ic \&!
0426a3b4 510Escape to local shell.
d0445371 511.It Ic \&?
0426a3b4 512Synonym for help.
513.El
61e96248 514.Sh SEE ALSO
433e60ac 515.Xr ftp 1 ,
f9d52dd1 516.Xr ls 1 ,
2cad6cef 517.Xr scp 1 ,
61e96248 518.Xr ssh 1 ,
519.Xr ssh-add 1 ,
520.Xr ssh-keygen 1 ,
f9d52dd1 521.Xr glob 3 ,
c21a7c4a 522.Xr ssh_config 5 ,
2cad6cef 523.Xr sftp-server 8 ,
524.Xr sshd 8
525.Rs
7b518233 526.%A T. Ylonen
527.%A S. Lehtinen
2cad6cef 528.%T "SSH File Transfer Protocol"
529.%N draft-ietf-secsh-filexfer-00.txt
530.%D January 2001
531.%O work in progress material
532.Re
This page took 0.367093 seconds and 5 git commands to generate.