]> andersk Git - openssh.git/blame - sftp.1
- stevesk@cvs.openbsd.org 2008/11/01 06:43:33
[openssh.git] / sftp.1
CommitLineData
b8c9ea19 1.\" $OpenBSD: sftp.1,v 1.67 2008/07/15 02:23:14 djm 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
433e60ac 34.Op Fl 1Cv
7d5e8c46 35.Op Fl B Ar buffer_size
433e60ac 36.Op Fl b Ar batchfile
7d5e8c46 37.Op Fl F Ar ssh_config
433e60ac 38.Op Fl o Ar ssh_option
39.Op Fl P Ar sftp_server_path
c25d3df7 40.Op Fl R Ar num_requests
e3c1c3e6 41.Op Fl S Ar program
433e60ac 42.Op Fl s Ar subsystem | sftp_server
e3c1c3e6 43.Ar host
a4e5acef 44.Ek
72c5fe79 45.Nm sftp
d0445371 46.Oo Oo Ar user Ns @ Oc Ns
a4e5acef 47.Ar host Ns Oo : Ns Ar file Oo
48.Ar file Oc Oc Oc
72c5fe79 49.Nm sftp
d0445371 50.Oo Oo Ar user Ns @ Oc Ns
a4e5acef 51.Ar host Ns Oo : Ns Ar dir Ns
52.Oo Ar / Oc Oc Oc
72c5fe79 53.Nm sftp
81466908 54.Fl b Ar batchfile
d0445371 55.Oo Ar user Ns @ Oc Ns Ar host
61e96248 56.Sh DESCRIPTION
57.Nm
58is an interactive file transfer program, similar to
59.Xr ftp 1 ,
60which performs all operations over an encrypted
61.Xr ssh 1
62transport.
63It may also use many features of ssh, such as public key authentication and
64compression.
65.Nm
66connects and logs into the specified
cf7ff074 67.Ar host ,
61e96248 68then enters an interactive command mode.
69.Pp
3730bb22 70The second usage format will retrieve files automatically if a non-interactive
cf7ff074 71authentication method is used; otherwise it will do so after
72successful interactive authentication.
edeeab1e 73.Pp
f9d52dd1 74The third usage format allows
75.Nm
76to start in a remote directory.
edeeab1e 77.Pp
bd47824b 78The final usage format allows for automated sessions using the
81466908 79.Fl b
bd47824b 80option.
3da242db 81In such cases, it is necessary to configure non-interactive authentication
bd47824b 82to obviate the need to enter a password at connection time (see
81466908 83.Xr sshd 8
72c5fe79 84and
81466908 85.Xr ssh-keygen 1
bd47824b 86for details).
61e96248 87The options are as follows:
88.Bl -tag -width Ds
433e60ac 89.It Fl 1
90Specify the use of protocol version 1.
91.It Fl B Ar buffer_size
92Specify the size of the buffer that
93.Nm
94uses when transferring files.
95Larger buffers require fewer round trips at the cost of higher
96memory consumption.
97The default is 32768 bytes.
a5ec8a3d 98.It Fl b Ar batchfile
99Batch mode reads a series of commands from an input
acf06a60 100.Ar batchfile
a5ec8a3d 101instead of
acf06a60 102.Em stdin .
103Since it lacks user interaction it should be used in conjunction with
f74de0d7 104non-interactive authentication.
a8b64bb8 105A
f74de0d7 106.Ar batchfile
107of
108.Sq \-
a8b64bb8 109may be used to indicate standard input.
acf06a60 110.Nm
3730bb22 111will abort if any of the following
112commands fail:
7e35f994 113.Ic get , put , rename , ln ,
a4e5acef 114.Ic rm , mkdir , chdir , ls ,
ea530517 115.Ic lchdir , chmod , chown ,
116.Ic chgrp , lpwd , df ,
a5ec8a3d 117and
acf06a60 118.Ic lmkdir .
a4e5acef 119Termination on error can be suppressed on a command by command basis by
120prefixing the command with a
f74de0d7 121.Sq \-
bd47824b 122character (for example,
123.Ic -rm /tmp/blah* ) .
433e60ac 124.It Fl C
125Enables compression (via ssh's
126.Fl C
127flag).
128.It Fl F Ar ssh_config
129Specifies an alternative
130per-user configuration file for
131.Xr ssh 1 .
132This option is directly passed to
133.Xr ssh 1 .
61e96248 134.It Fl o Ar ssh_option
38539909 135Can be used to pass options to
136.Nm ssh
c21a7c4a 137in the format used in
138.Xr ssh_config 5 .
139This is useful for specifying options
38539909 140for which there is no separate
141.Nm sftp
bd47824b 142command-line flag.
143For example, to specify an alternate port use:
e3c1c3e6 144.Ic sftp -oPort=24 .
433e60ac 145For full details of the options listed below, and their possible values, see
146.Xr ssh_config 5 .
147.Pp
148.Bl -tag -width Ds -offset indent -compact
149.It AddressFamily
150.It BatchMode
151.It BindAddress
152.It ChallengeResponseAuthentication
153.It CheckHostIP
154.It Cipher
155.It Ciphers
433e60ac 156.It Compression
157.It CompressionLevel
158.It ConnectionAttempts
927fcba2 159.It ConnectTimeout
5e96b616 160.It ControlMaster
161.It ControlPath
433e60ac 162.It GlobalKnownHostsFile
163.It GSSAPIAuthentication
164.It GSSAPIDelegateCredentials
ba9d1100 165.It HashKnownHosts
433e60ac 166.It Host
167.It HostbasedAuthentication
168.It HostKeyAlgorithms
169.It HostKeyAlias
170.It HostName
171.It IdentityFile
3a065ed0 172.It IdentitiesOnly
396070f8 173.It KbdInteractiveDevices
433e60ac 174.It LogLevel
175.It MACs
176.It NoHostAuthenticationForLocalhost
177.It NumberOfPasswordPrompts
178.It PasswordAuthentication
179.It Port
180.It PreferredAuthentications
181.It Protocol
182.It ProxyCommand
183.It PubkeyAuthentication
db175906 184.It RekeyLimit
433e60ac 185.It RhostsRSAAuthentication
186.It RSAAuthentication
8e99a198 187.It SendEnv
5d8d32a3 188.It ServerAliveInterval
189.It ServerAliveCountMax
433e60ac 190.It SmartcardDevice
191.It StrictHostKeyChecking
fd573618 192.It TCPKeepAlive
433e60ac 193.It UsePrivilegedPort
194.It User
195.It UserKnownHostsFile
196.It VerifyHostKeyDNS
433e60ac 197.El
198.It Fl P Ar sftp_server_path
bd47824b 199Connect directly to a local sftp server
7d5e8c46 200(rather than via
281cf948 201.Xr ssh 1 ) .
7d5e8c46 202This option may be useful in debugging the client and server.
c25d3df7 203.It Fl R Ar num_requests
bd47824b 204Specify how many requests may be outstanding at any one time.
205Increasing this may slightly improve file transfer speed
206but will increase memory usage.
b8c9ea19 207The default is 64 outstanding requests.
e3c1c3e6 208.It Fl S Ar program
209Name of the
210.Ar program
211to use for the encrypted connection.
212The program must understand
213.Xr ssh 1
214options.
433e60ac 215.It Fl s Ar subsystem | sftp_server
216Specifies the SSH2 subsystem or the path for an sftp server
217on the remote host.
218A path is useful for using
219.Nm
220over protocol version 1, or when the remote
221.Xr sshd 8
222does not have an sftp subsystem configured.
223.It Fl v
224Raise logging level.
225This option is also passed to ssh.
61e96248 226.El
227.Sh INTERACTIVE COMMANDS
0426a3b4 228Once in interactive mode,
229.Nm
3730bb22 230understands a set of commands similar to those of
61e96248 231.Xr ftp 1 .
f9d52dd1 232Commands are case insensitive.
233Pathnames that contain spaces must be enclosed in quotes.
234Any special characters contained within pathnames that are recognized by
235.Xr glob 3
236must be escaped with backslashes
237.Pq Sq \e .
238.Bl -tag -width Ds
68874d2b 239.It Ic bye
bd47824b 240Quit
241.Nm sftp .
0426a3b4 242.It Ic cd Ar path
3730bb22 243Change remote directory to
0426a3b4 244.Ar path .
0426a3b4 245.It Ic chgrp Ar grp Ar path
3730bb22 246Change group of file
0426a3b4 247.Ar path
248to
61e96248 249.Ar grp .
f9d52dd1 250.Ar path
251may contain
252.Xr glob 3
253characters and may match multiple files.
61e96248 254.Ar grp
0426a3b4 255must be a numeric GID.
256.It Ic chmod Ar mode Ar path
3730bb22 257Change permissions of file
0426a3b4 258.Ar path
259to
260.Ar mode .
f9d52dd1 261.Ar path
262may contain
263.Xr glob 3
264characters and may match multiple files.
0426a3b4 265.It Ic chown Ar own Ar path
3730bb22 266Change owner of file
0426a3b4 267.Ar path
268to
61e96248 269.Ar own .
f9d52dd1 270.Ar path
271may contain
272.Xr glob 3
273characters and may match multiple files.
61e96248 274.Ar own
275must be a numeric UID.
360b43ab 276.It Xo Ic df
277.Op Fl hi
278.Op Ar path
279.Xc
280Display usage information for the filesystem holding the current directory
281(or
282.Ar path
283if specified).
284If the
285.Fl h
286flag is specified, the capacity information will be displayed using
287"human-readable" suffixes.
288The
289.Fl i
290flag requests display of inode information in addition to capacity information.
291This command is only supported on servers that implement the
292.Dq statvfs@openssh.com
293extension.
17910dce 294.It Ic exit
bd47824b 295Quit
296.Nm sftp .
58c54a79 297.It Xo Ic get
f9d52dd1 298.Op Fl P
58c54a79 299.Ar remote-path
300.Op Ar local-path
301.Xc
61e96248 302Retrieve the
0426a3b4 303.Ar remote-path
61e96248 304and store it on the local machine.
305If the local
3730bb22 306path name is not specified, it is given the same name it has on the
bd47824b 307remote machine.
f9d52dd1 308.Ar remote-path
309may contain
310.Xr glob 3
311characters and may match multiple files.
312If it does and
313.Ar local-path
314is specified, then
315.Ar local-path
316must specify a directory.
bd47824b 317If the
58c54a79 318.Fl P
f9d52dd1 319flag is specified, then full file permissions and access times are
58c54a79 320copied too.
17910dce 321.It Ic help
322Display help text.
433e60ac 323.It Ic lcd Ar path
324Change local directory to
325.Ar path .
0426a3b4 326.It Ic lls Op Ar ls-options Op Ar path
3730bb22 327Display local directory listing of either
61e96248 328.Ar path
329or current directory if
330.Ar path
0426a3b4 331is not specified.
f9d52dd1 332.Ar ls-options
333may contain any flags supported by the local system's
334.Xr ls 1
335command.
336.Ar path
337may contain
338.Xr glob 3
339characters and may match multiple files.
0426a3b4 340.It Ic lmkdir Ar path
61e96248 341Create local directory specified by
0426a3b4 342.Ar path .
3a7fe5ba 343.It Ic ln Ar oldpath Ar newpath
3730bb22 344Create a symbolic link from
3a7fe5ba 345.Ar oldpath
346to
347.Ar newpath .
0426a3b4 348.It Ic lpwd
349Print local working directory.
00b3ad3e 350.It Xo Ic ls
f9d52dd1 351.Op Fl 1aflnrSt
00b3ad3e 352.Op Ar path
353.Xc
f9d52dd1 354Display a remote directory listing of either
61e96248 355.Ar path
f9d52dd1 356or the current directory if
0426a3b4 357.Ar path
bd47824b 358is not specified.
f9d52dd1 359.Ar path
360may contain
361.Xr glob 3
362characters and may match multiple files.
c4c84934 363.Pp
f9d52dd1 364The following flags are recognized and alter the behaviour of
c4c84934 365.Ic ls
f9d52dd1 366accordingly:
367.Bl -tag -width Ds
368.It Fl 1
369Produce single columnar output.
370.It Fl a
371List files beginning with a dot
372.Pq Sq \&. .
373.It Fl f
374Do not sort the listing.
375The default sort order is lexicographical.
376.It Fl l
377Display additional details including permissions
378and ownership information.
379.It Fl n
380Produce a long listing with user and group information presented
381numerically.
382.It Fl r
383Reverse the sort order of the listing.
384.It Fl S
385Sort the listing by file size.
386.It Fl t
387Sort the listing by last modification time.
388.El
0426a3b4 389.It Ic lumask Ar umask
3730bb22 390Set local umask to
0426a3b4 391.Ar umask .
392.It Ic mkdir Ar path
61e96248 393Create remote directory specified by
0426a3b4 394.Ar path .
b65c3807 395.It Ic progress
396Toggle display of progress meter.
58c54a79 397.It Xo Ic put
f9d52dd1 398.Op Fl P
58c54a79 399.Ar local-path
2ea16b0b 400.Op Ar remote-path
58c54a79 401.Xc
61e96248 402Upload
0426a3b4 403.Ar local-path
bd47824b 404and store it on the remote machine.
405If the remote path name is not specified, it is given the same name it has
406on the local machine.
f9d52dd1 407.Ar local-path
408may contain
409.Xr glob 3
410characters and may match multiple files.
411If it does and
412.Ar remote-path
413is specified, then
414.Ar remote-path
415must specify a directory.
bd47824b 416If the
58c54a79 417.Fl P
418flag is specified, then the file's full permission and access time are
419copied too.
0426a3b4 420.It Ic pwd
421Display remote working directory.
0426a3b4 422.It Ic quit
bd47824b 423Quit
424.Nm sftp .
0426a3b4 425.It Ic rename Ar oldpath Ar newpath
61e96248 426Rename remote file from
427.Ar oldpath
428to
0426a3b4 429.Ar newpath .
0426a3b4 430.It Ic rm Ar path
61e96248 431Delete remote file specified by
0426a3b4 432.Ar path .
433e60ac 433.It Ic rmdir Ar path
434Remove remote directory specified by
435.Ar path .
3a7fe5ba 436.It Ic symlink Ar oldpath Ar newpath
3730bb22 437Create a symbolic link from
3a7fe5ba 438.Ar oldpath
439to
440.Ar newpath .
048ff12c 441.It Ic version
442Display the
443.Nm
444protocol version.
d0445371 445.It Ic \&! Ar command
3730bb22 446Execute
61e96248 447.Ar command
0426a3b4 448in local shell.
d0445371 449.It Ic \&!
0426a3b4 450Escape to local shell.
d0445371 451.It Ic \&?
0426a3b4 452Synonym for help.
453.El
61e96248 454.Sh SEE ALSO
433e60ac 455.Xr ftp 1 ,
f9d52dd1 456.Xr ls 1 ,
2cad6cef 457.Xr scp 1 ,
61e96248 458.Xr ssh 1 ,
459.Xr ssh-add 1 ,
460.Xr ssh-keygen 1 ,
f9d52dd1 461.Xr glob 3 ,
c21a7c4a 462.Xr ssh_config 5 ,
2cad6cef 463.Xr sftp-server 8 ,
464.Xr sshd 8
465.Rs
7b518233 466.%A T. Ylonen
467.%A S. Lehtinen
2cad6cef 468.%T "SSH File Transfer Protocol"
469.%N draft-ietf-secsh-filexfer-00.txt
470.%D January 2001
471.%O work in progress material
472.Re
This page took 0.339779 seconds and 5 git commands to generate.