blob: 252e43ab26a7fe74534e6b2685e8fbfc45a7c60c [file] [log] [blame]
Damien Millerd6ead282003-05-14 19:30:38 +10001.\" $OpenBSD: sftp.1,v 1.43 2003/05/14 08:25:39 jmc Exp $
Damien Miller33804262001-02-04 23:20:18 +11002.\"
Ben Lindstrom92a2e382001-03-05 06:59:27 +00003.\" Copyright (c) 2001 Damien Miller. All rights reserved.
Damien Miller33804262001-02-04 23:20:18 +11004.\"
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.\"
Ben Lindstrom8ffeacf2001-04-10 02:43:57 +000025.Dd February 4, 2001
Damien Miller33804262001-02-04 23:20:18 +110026.Dt SFTP 1
27.Os
28.Sh NAME
29.Nm sftp
Damien Miller225736c2001-02-19 21:51:08 +110030.Nd Secure file transfer program
Damien Miller33804262001-02-04 23:20:18 +110031.Sh SYNOPSIS
Damien Millerd6ead282003-05-14 19:30:38 +100032.Nm sftp
Damien Miller495dca32003-04-01 21:42:14 +100033.Bk -words
Damien Miller81b6e782002-02-08 22:06:03 +110034.Op Fl vC1
Ben Lindstrom562c26b2001-03-07 01:26:48 +000035.Op Fl b Ar batchfile
Damien Miller33804262001-02-04 23:20:18 +110036.Op Fl o Ar ssh_option
Ben Lindstrom6a337632001-09-18 05:47:32 +000037.Op Fl s Ar subsystem | sftp_server
Damien Miller81b6e782002-02-08 22:06:03 +110038.Op Fl B Ar buffer_size
39.Op Fl F Ar ssh_config
40.Op Fl P Ar sftp_server path
Damien Miller16a13332002-02-13 14:03:56 +110041.Op Fl R Ar num_requests
Ben Lindstrom6a337632001-09-18 05:47:32 +000042.Op Fl S Ar program
43.Ar host
Damien Miller495dca32003-04-01 21:42:14 +100044.Ek
Damien Millerd6ead282003-05-14 19:30:38 +100045.Nm sftp
Damien Miller495dca32003-04-01 21:42:14 +100046.Oo Oo Ar user Ns No @ Oc Ns
47.Ar host Ns Oo : Ns Ar file Oo
48.Ar file Oc Oc Oc
Damien Millerd6ead282003-05-14 19:30:38 +100049.Nm sftp
Damien Miller495dca32003-04-01 21:42:14 +100050.Oo Oo Ar user Ns No @ Oc Ns
51.Ar host Ns Oo : Ns Ar dir Ns
52.Oo Ar / Oc Oc Oc
Damien Millerd6ead282003-05-14 19:30:38 +100053.Nm sftp
Damien Millerfb7508e2003-05-14 13:47:07 +100054.Fl b Ar batchfile
55.Oo Ar user Ns No @ Oc Ns Ar host Ns
Damien Miller33804262001-02-04 23:20:18 +110056.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
Ben Lindstromaafff9c2001-05-06 03:01:02 +000067.Ar host ,
Damien Miller33804262001-02-04 23:20:18 +110068then enters an interactive command mode.
69.Pp
Ben Lindstrom24643222001-06-25 05:08:11 +000070The second usage format will retrieve files automatically if a non-interactive
Ben Lindstromaafff9c2001-05-06 03:01:02 +000071authentication method is used; otherwise it will do so after
72successful interactive authentication.
Ben Lindstrom63667f62001-04-13 00:00:14 +000073.Pp
Damien Millerfb7508e2003-05-14 13:47:07 +100074The third usage format allows the sftp client to start in a remote directory.
Ben Lindstrom63667f62001-04-13 00:00:14 +000075.Pp
Damien Millerd6ead282003-05-14 19:30:38 +100076The final usage form allows for automated sessions using the
Damien Millerfb7508e2003-05-14 13:47:07 +100077.Fl b
78option. In such cases, it is usually necessary to configure public key
Damien Millerd6ead282003-05-14 19:30:38 +100079authentication to obviate the need to enter a password at connection
80time (see
Damien Millerfb7508e2003-05-14 13:47:07 +100081.Xr sshd 8
Damien Millerd6ead282003-05-14 19:30:38 +100082and
Damien Millerfb7508e2003-05-14 13:47:07 +100083.Xr ssh-keygen 1
84for details.)
Damien Miller33804262001-02-04 23:20:18 +110085The options are as follows:
86.Bl -tag -width Ds
Ben Lindstrom562c26b2001-03-07 01:26:48 +000087.It Fl b Ar batchfile
88Batch mode reads a series of commands from an input
Ben Lindstrom283cb822001-03-09 00:09:02 +000089.Ar batchfile
Ben Lindstrom562c26b2001-03-07 01:26:48 +000090instead of
Ben Lindstrom283cb822001-03-09 00:09:02 +000091.Em stdin .
92Since it lacks user interaction it should be used in conjunction with
93non-interactive authentication.
94.Nm
Ben Lindstrom24643222001-06-25 05:08:11 +000095will abort if any of the following
96commands fail:
Ben Lindstrom3612bda2002-03-05 01:26:38 +000097.Ic get , put , rename , ln ,
Damien Miller495dca32003-04-01 21:42:14 +100098.Ic rm , mkdir , chdir , ls ,
Damien Miller956f3fb2003-01-10 21:40:00 +110099.Ic lchdir , chmod , chown , chgrp , lpwd
Ben Lindstrom562c26b2001-03-07 01:26:48 +0000100and
Ben Lindstrom283cb822001-03-09 00:09:02 +0000101.Ic lmkdir .
Damien Miller495dca32003-04-01 21:42:14 +1000102Termination on error can be suppressed on a command by command basis by
103prefixing the command with a
104.Ic '-'
Damien Miller956f3fb2003-01-10 21:40:00 +1100105character (For example,
106.Ic -rm /tmp/blah*
107).
Damien Miller33804262001-02-04 23:20:18 +1100108.It Fl o Ar ssh_option
Ben Lindstrom14c62eb2001-08-15 23:25:46 +0000109Can be used to pass options to
110.Nm ssh
Ben Lindstrom3072aae2002-06-21 01:02:39 +0000111in the format used in
112.Xr ssh_config 5 .
113This is useful for specifying options
Ben Lindstrom14c62eb2001-08-15 23:25:46 +0000114for which there is no separate
115.Nm sftp
Damien Miller495dca32003-04-01 21:42:14 +1000116command-line flag. For example, to specify an alternate
Ben Lindstrom6a337632001-09-18 05:47:32 +0000117port use:
118.Ic sftp -oPort=24 .
119.It Fl s Ar subsystem | sftp_server
120Specifies the SSH2 subsystem or the path for an sftp server
Damien Miller495dca32003-04-01 21:42:14 +1000121on the remote host. A path is useful for using sftp over
Ben Lindstrom6a337632001-09-18 05:47:32 +0000122protocol version 1, or when the remote
123.Nm sshd
124does not have an sftp subsystem configured.
Damien Miller81b6e782002-02-08 22:06:03 +1100125.It Fl v
126Raise logging level. This option is also passed to ssh.
127.It Fl B Ar buffer_size
Damien Miller495dca32003-04-01 21:42:14 +1000128Specify the size of the buffer that
Damien Miller81b6e782002-02-08 22:06:03 +1100129.Nm
130uses when transferring files. Larger buffers require fewer round trips at
131the cost of higher memory consumption. The default is 32768 bytes.
132.It Fl C
133Enables compression (via ssh's
134.Fl C
135flag).
136.It Fl F Ar ssh_config
137Specifies an alternative
138per-user configuration file for
139.Nm ssh .
140This option is directly passed to
141.Xr ssh 1 .
142.It Fl P Ar sftp_server path
Ben Lindstromcb72e4f2002-06-21 00:41:51 +0000143Connect directly to a local
144.Nm sftp-server
Damien Miller81b6e782002-02-08 22:06:03 +1100145(rather than via
146.Nm ssh )
147This option may be useful in debugging the client and server.
Damien Miller16a13332002-02-13 14:03:56 +1100148.It Fl R Ar num_requests
Ben Lindstromcb72e4f2002-06-21 00:41:51 +0000149Specify how many requests may be outstanding at any one time. Increasing
Damien Miller16a13332002-02-13 14:03:56 +1100150this may slightly improve file transfer speed but will increase memory
151usage. The default is 16 outstanding requests.
Ben Lindstrom6a337632001-09-18 05:47:32 +0000152.It Fl S Ar program
153Name of the
154.Ar program
155to use for the encrypted connection.
156The program must understand
157.Xr ssh 1
158options.
Damien Miller81b6e782002-02-08 22:06:03 +1100159.It Fl 1
160Specify the use of protocol version 1.
Damien Miller33804262001-02-04 23:20:18 +1100161.El
162.Sh INTERACTIVE COMMANDS
Damien Millerd7686fd2001-02-10 00:40:03 +1100163Once in interactive mode,
164.Nm
Ben Lindstrom24643222001-06-25 05:08:11 +0000165understands a set of commands similar to those of
Damien Miller33804262001-02-04 23:20:18 +1100166.Xr ftp 1 .
Ben Lindstrom27cb1d02001-02-10 21:59:35 +0000167Commands are case insensitive and pathnames may be enclosed in quotes if they
168contain spaces.
Damien Miller33804262001-02-04 23:20:18 +1100169.Bl -tag -width Ds
Ben Lindstrom59e12492001-08-15 23:22:56 +0000170.It Ic bye
171Quit sftp.
Damien Millerd7686fd2001-02-10 00:40:03 +1100172.It Ic cd Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000173Change remote directory to
Damien Millerd7686fd2001-02-10 00:40:03 +1100174.Ar path .
175.It Ic lcd Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000176Change local directory to
Damien Millerd7686fd2001-02-10 00:40:03 +1100177.Ar path .
178.It Ic chgrp Ar grp Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000179Change group of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100180.Ar path
181to
Damien Miller33804262001-02-04 23:20:18 +1100182.Ar grp .
183.Ar grp
Damien Millerd7686fd2001-02-10 00:40:03 +1100184must be a numeric GID.
185.It Ic chmod Ar mode Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000186Change permissions of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100187.Ar path
188to
189.Ar mode .
190.It Ic chown Ar own Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000191Change owner of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100192.Ar path
193to
Damien Miller33804262001-02-04 23:20:18 +1100194.Ar own .
195.Ar own
196must be a numeric UID.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000197.It Ic exit
198Quit sftp.
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000199.It Xo Ic get
200.Op Ar flags
201.Ar remote-path
202.Op Ar local-path
203.Xc
Damien Miller33804262001-02-04 23:20:18 +1100204Retrieve the
Damien Millerd7686fd2001-02-10 00:40:03 +1100205.Ar remote-path
Damien Miller33804262001-02-04 23:20:18 +1100206and store it on the local machine.
207If the local
Ben Lindstrom24643222001-06-25 05:08:11 +0000208path name is not specified, it is given the same name it has on the
209remote machine. If the
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000210.Fl P
211flag is specified, then the file's full permission and access time are
212copied too.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000213.It Ic help
214Display help text.
Damien Millerd7686fd2001-02-10 00:40:03 +1100215.It Ic lls Op Ar ls-options Op Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000216Display local directory listing of either
Damien Miller33804262001-02-04 23:20:18 +1100217.Ar path
218or current directory if
219.Ar path
Damien Millerd7686fd2001-02-10 00:40:03 +1100220is not specified.
221.It Ic lmkdir Ar path
Damien Miller33804262001-02-04 23:20:18 +1100222Create local directory specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100223.Ar path .
Damien Miller058316f2001-03-08 10:08:49 +1100224.It Ic ln Ar oldpath Ar newpath
Ben Lindstrom24643222001-06-25 05:08:11 +0000225Create a symbolic link from
Damien Miller058316f2001-03-08 10:08:49 +1100226.Ar oldpath
227to
228.Ar newpath .
Damien Millerd7686fd2001-02-10 00:40:03 +1100229.It Ic lpwd
230Print local working directory.
Damien Millere1a49812002-09-12 09:54:25 +1000231.It Xo Ic ls
232.Op Ar flags
233.Op Ar path
234.Xc
Damien Miller33804262001-02-04 23:20:18 +1100235Display remote directory listing of either
236.Ar path
Damien Millerd7686fd2001-02-10 00:40:03 +1100237or current directory if
Damien Miller33804262001-02-04 23:20:18 +1100238.Ar path
Damien Millere1a49812002-09-12 09:54:25 +1000239is not specified. If the
240.Fl l
241flag is specified, then display additional details including permissions
242and ownership information.
Damien Millerd7686fd2001-02-10 00:40:03 +1100243.It Ic lumask Ar umask
Ben Lindstrom24643222001-06-25 05:08:11 +0000244Set local umask to
Damien Millerd7686fd2001-02-10 00:40:03 +1100245.Ar umask .
246.It Ic mkdir Ar path
247Create remote directory specified by
248.Ar path .
Damien Miller62d57f62003-01-10 21:43:24 +1100249.It Ic progress
250Toggle display of progress meter.
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000251.It Xo Ic put
252.Op Ar flags
253.Ar local-path
Ben Lindstromd5767812002-12-23 02:23:37 +0000254.Op Ar remote-path
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000255.Xc
Damien Miller33804262001-02-04 23:20:18 +1100256Upload
Damien Millerd7686fd2001-02-10 00:40:03 +1100257.Ar local-path
Ben Lindstrom24643222001-06-25 05:08:11 +0000258and store it on the remote machine. If the remote path name is not
259specified, it is given the same name it has on the local machine. If the
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000260.Fl P
261flag is specified, then the file's full permission and access time are
262copied too.
Damien Millerd7686fd2001-02-10 00:40:03 +1100263.It Ic pwd
264Display remote working directory.
Damien Millerd7686fd2001-02-10 00:40:03 +1100265.It Ic quit
266Quit sftp.
267.It Ic rename Ar oldpath Ar newpath
Damien Miller33804262001-02-04 23:20:18 +1100268Rename remote file from
269.Ar oldpath
270to
Damien Millerd7686fd2001-02-10 00:40:03 +1100271.Ar newpath .
272.It Ic rmdir Ar path
Damien Miller33804262001-02-04 23:20:18 +1100273Remove remote directory specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100274.Ar path .
275.It Ic rm Ar path
Damien Miller33804262001-02-04 23:20:18 +1100276Delete remote file specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100277.Ar path .
Damien Miller058316f2001-03-08 10:08:49 +1100278.It Ic symlink Ar oldpath Ar newpath
Ben Lindstrom24643222001-06-25 05:08:11 +0000279Create a symbolic link from
Damien Miller058316f2001-03-08 10:08:49 +1100280.Ar oldpath
281to
282.Ar newpath .
Damien Miller63421802003-01-08 14:05:23 +1100283.It Ic version
284Display the
285.Nm
286protocol version.
Damien Miller33804262001-02-04 23:20:18 +1100287.It Ic ! Ar command
Ben Lindstrom24643222001-06-25 05:08:11 +0000288Execute
Damien Miller33804262001-02-04 23:20:18 +1100289.Ar command
Damien Millerd7686fd2001-02-10 00:40:03 +1100290in local shell.
Damien Miller33804262001-02-04 23:20:18 +1100291.It Ic !
Damien Millerd7686fd2001-02-10 00:40:03 +1100292Escape to local shell.
293.It Ic ?
294Synonym for help.
295.El
Damien Miller33804262001-02-04 23:20:18 +1100296.Sh SEE ALSO
Ben Lindstrom160ec622001-04-22 17:17:46 +0000297.Xr scp 1 ,
Damien Miller33804262001-02-04 23:20:18 +1100298.Xr ssh 1 ,
299.Xr ssh-add 1 ,
300.Xr ssh-keygen 1 ,
Ben Lindstrom3072aae2002-06-21 01:02:39 +0000301.Xr ssh_config 5 ,
Ben Lindstrom160ec622001-04-22 17:17:46 +0000302.Xr sftp-server 8 ,
303.Xr sshd 8
304.Rs
Ben Lindstrom90fd0602001-06-25 04:45:33 +0000305.%A T. Ylonen
306.%A S. Lehtinen
Ben Lindstrom160ec622001-04-22 17:17:46 +0000307.%T "SSH File Transfer Protocol"
308.%N draft-ietf-secsh-filexfer-00.txt
309.%D January 2001
310.%O work in progress material
311.Re