blob: 02d2c274bb3611951f53283d3afb0e7c39e352fe [file] [log] [blame]
Damien Miller495dca32003-04-01 21:42:14 +10001.\" $OpenBSD: sftp.1,v 1.41 2003/03/28 10:11:43 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
32.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
Ben Lindstrom63667f62001-04-13 00:00:14 +000045.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
Ben Lindstrom63667f62001-04-13 00:00:14 +000049.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 Miller33804262001-02-04 23:20:18 +110053.Sh DESCRIPTION
54.Nm
55is an interactive file transfer program, similar to
56.Xr ftp 1 ,
57which performs all operations over an encrypted
58.Xr ssh 1
59transport.
60It may also use many features of ssh, such as public key authentication and
61compression.
62.Nm
63connects and logs into the specified
Ben Lindstromaafff9c2001-05-06 03:01:02 +000064.Ar host ,
Damien Miller33804262001-02-04 23:20:18 +110065then enters an interactive command mode.
66.Pp
Ben Lindstrom24643222001-06-25 05:08:11 +000067The second usage format will retrieve files automatically if a non-interactive
Ben Lindstromaafff9c2001-05-06 03:01:02 +000068authentication method is used; otherwise it will do so after
69successful interactive authentication.
Ben Lindstrom63667f62001-04-13 00:00:14 +000070.Pp
71The last usage format allows the sftp client to start in a remote directory.
72.Pp
Damien Miller33804262001-02-04 23:20:18 +110073The options are as follows:
74.Bl -tag -width Ds
Ben Lindstrom562c26b2001-03-07 01:26:48 +000075.It Fl b Ar batchfile
76Batch mode reads a series of commands from an input
Ben Lindstrom283cb822001-03-09 00:09:02 +000077.Ar batchfile
Ben Lindstrom562c26b2001-03-07 01:26:48 +000078instead of
Ben Lindstrom283cb822001-03-09 00:09:02 +000079.Em stdin .
80Since it lacks user interaction it should be used in conjunction with
81non-interactive authentication.
82.Nm
Ben Lindstrom24643222001-06-25 05:08:11 +000083will abort if any of the following
84commands fail:
Ben Lindstrom3612bda2002-03-05 01:26:38 +000085.Ic get , put , rename , ln ,
Damien Miller495dca32003-04-01 21:42:14 +100086.Ic rm , mkdir , chdir , ls ,
Damien Miller956f3fb2003-01-10 21:40:00 +110087.Ic lchdir , chmod , chown , chgrp , lpwd
Ben Lindstrom562c26b2001-03-07 01:26:48 +000088and
Ben Lindstrom283cb822001-03-09 00:09:02 +000089.Ic lmkdir .
Damien Miller495dca32003-04-01 21:42:14 +100090Termination on error can be suppressed on a command by command basis by
91prefixing the command with a
92.Ic '-'
Damien Miller956f3fb2003-01-10 21:40:00 +110093character (For example,
94.Ic -rm /tmp/blah*
95).
Damien Miller33804262001-02-04 23:20:18 +110096.It Fl o Ar ssh_option
Ben Lindstrom14c62eb2001-08-15 23:25:46 +000097Can be used to pass options to
98.Nm ssh
Ben Lindstrom3072aae2002-06-21 01:02:39 +000099in the format used in
100.Xr ssh_config 5 .
101This is useful for specifying options
Ben Lindstrom14c62eb2001-08-15 23:25:46 +0000102for which there is no separate
103.Nm sftp
Damien Miller495dca32003-04-01 21:42:14 +1000104command-line flag. For example, to specify an alternate
Ben Lindstrom6a337632001-09-18 05:47:32 +0000105port use:
106.Ic sftp -oPort=24 .
107.It Fl s Ar subsystem | sftp_server
108Specifies the SSH2 subsystem or the path for an sftp server
Damien Miller495dca32003-04-01 21:42:14 +1000109on the remote host. A path is useful for using sftp over
Ben Lindstrom6a337632001-09-18 05:47:32 +0000110protocol version 1, or when the remote
111.Nm sshd
112does not have an sftp subsystem configured.
Damien Miller81b6e782002-02-08 22:06:03 +1100113.It Fl v
114Raise logging level. This option is also passed to ssh.
115.It Fl B Ar buffer_size
Damien Miller495dca32003-04-01 21:42:14 +1000116Specify the size of the buffer that
Damien Miller81b6e782002-02-08 22:06:03 +1100117.Nm
118uses when transferring files. Larger buffers require fewer round trips at
119the cost of higher memory consumption. The default is 32768 bytes.
120.It Fl C
121Enables compression (via ssh's
122.Fl C
123flag).
124.It Fl F Ar ssh_config
125Specifies an alternative
126per-user configuration file for
127.Nm ssh .
128This option is directly passed to
129.Xr ssh 1 .
130.It Fl P Ar sftp_server path
Ben Lindstromcb72e4f2002-06-21 00:41:51 +0000131Connect directly to a local
132.Nm sftp-server
Damien Miller81b6e782002-02-08 22:06:03 +1100133(rather than via
134.Nm ssh )
135This option may be useful in debugging the client and server.
Damien Miller16a13332002-02-13 14:03:56 +1100136.It Fl R Ar num_requests
Ben Lindstromcb72e4f2002-06-21 00:41:51 +0000137Specify how many requests may be outstanding at any one time. Increasing
Damien Miller16a13332002-02-13 14:03:56 +1100138this may slightly improve file transfer speed but will increase memory
139usage. The default is 16 outstanding requests.
Ben Lindstrom6a337632001-09-18 05:47:32 +0000140.It Fl S Ar program
141Name of the
142.Ar program
143to use for the encrypted connection.
144The program must understand
145.Xr ssh 1
146options.
Damien Miller81b6e782002-02-08 22:06:03 +1100147.It Fl 1
148Specify the use of protocol version 1.
Damien Miller33804262001-02-04 23:20:18 +1100149.El
150.Sh INTERACTIVE COMMANDS
Damien Millerd7686fd2001-02-10 00:40:03 +1100151Once in interactive mode,
152.Nm
Ben Lindstrom24643222001-06-25 05:08:11 +0000153understands a set of commands similar to those of
Damien Miller33804262001-02-04 23:20:18 +1100154.Xr ftp 1 .
Ben Lindstrom27cb1d02001-02-10 21:59:35 +0000155Commands are case insensitive and pathnames may be enclosed in quotes if they
156contain spaces.
Damien Miller33804262001-02-04 23:20:18 +1100157.Bl -tag -width Ds
Ben Lindstrom59e12492001-08-15 23:22:56 +0000158.It Ic bye
159Quit sftp.
Damien Millerd7686fd2001-02-10 00:40:03 +1100160.It Ic cd Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000161Change remote directory to
Damien Millerd7686fd2001-02-10 00:40:03 +1100162.Ar path .
163.It Ic lcd Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000164Change local directory to
Damien Millerd7686fd2001-02-10 00:40:03 +1100165.Ar path .
166.It Ic chgrp Ar grp Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000167Change group of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100168.Ar path
169to
Damien Miller33804262001-02-04 23:20:18 +1100170.Ar grp .
171.Ar grp
Damien Millerd7686fd2001-02-10 00:40:03 +1100172must be a numeric GID.
173.It Ic chmod Ar mode Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000174Change permissions of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100175.Ar path
176to
177.Ar mode .
178.It Ic chown Ar own Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000179Change owner of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100180.Ar path
181to
Damien Miller33804262001-02-04 23:20:18 +1100182.Ar own .
183.Ar own
184must be a numeric UID.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000185.It Ic exit
186Quit sftp.
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000187.It Xo Ic get
188.Op Ar flags
189.Ar remote-path
190.Op Ar local-path
191.Xc
Damien Miller33804262001-02-04 23:20:18 +1100192Retrieve the
Damien Millerd7686fd2001-02-10 00:40:03 +1100193.Ar remote-path
Damien Miller33804262001-02-04 23:20:18 +1100194and store it on the local machine.
195If the local
Ben Lindstrom24643222001-06-25 05:08:11 +0000196path name is not specified, it is given the same name it has on the
197remote machine. If the
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000198.Fl P
199flag is specified, then the file's full permission and access time are
200copied too.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000201.It Ic help
202Display help text.
Damien Millerd7686fd2001-02-10 00:40:03 +1100203.It Ic lls Op Ar ls-options Op Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000204Display local directory listing of either
Damien Miller33804262001-02-04 23:20:18 +1100205.Ar path
206or current directory if
207.Ar path
Damien Millerd7686fd2001-02-10 00:40:03 +1100208is not specified.
209.It Ic lmkdir Ar path
Damien Miller33804262001-02-04 23:20:18 +1100210Create local directory specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100211.Ar path .
Damien Miller058316f2001-03-08 10:08:49 +1100212.It Ic ln Ar oldpath Ar newpath
Ben Lindstrom24643222001-06-25 05:08:11 +0000213Create a symbolic link from
Damien Miller058316f2001-03-08 10:08:49 +1100214.Ar oldpath
215to
216.Ar newpath .
Damien Millerd7686fd2001-02-10 00:40:03 +1100217.It Ic lpwd
218Print local working directory.
Damien Millere1a49812002-09-12 09:54:25 +1000219.It Xo Ic ls
220.Op Ar flags
221.Op Ar path
222.Xc
Damien Miller33804262001-02-04 23:20:18 +1100223Display remote directory listing of either
224.Ar path
Damien Millerd7686fd2001-02-10 00:40:03 +1100225or current directory if
Damien Miller33804262001-02-04 23:20:18 +1100226.Ar path
Damien Millere1a49812002-09-12 09:54:25 +1000227is not specified. If the
228.Fl l
229flag is specified, then display additional details including permissions
230and ownership information.
Damien Millerd7686fd2001-02-10 00:40:03 +1100231.It Ic lumask Ar umask
Ben Lindstrom24643222001-06-25 05:08:11 +0000232Set local umask to
Damien Millerd7686fd2001-02-10 00:40:03 +1100233.Ar umask .
234.It Ic mkdir Ar path
235Create remote directory specified by
236.Ar path .
Damien Miller62d57f62003-01-10 21:43:24 +1100237.It Ic progress
238Toggle display of progress meter.
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000239.It Xo Ic put
240.Op Ar flags
241.Ar local-path
Ben Lindstromd5767812002-12-23 02:23:37 +0000242.Op Ar remote-path
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000243.Xc
Damien Miller33804262001-02-04 23:20:18 +1100244Upload
Damien Millerd7686fd2001-02-10 00:40:03 +1100245.Ar local-path
Ben Lindstrom24643222001-06-25 05:08:11 +0000246and store it on the remote machine. If the remote path name is not
247specified, it is given the same name it has on the local machine. If the
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000248.Fl P
249flag is specified, then the file's full permission and access time are
250copied too.
Damien Millerd7686fd2001-02-10 00:40:03 +1100251.It Ic pwd
252Display remote working directory.
Damien Millerd7686fd2001-02-10 00:40:03 +1100253.It Ic quit
254Quit sftp.
255.It Ic rename Ar oldpath Ar newpath
Damien Miller33804262001-02-04 23:20:18 +1100256Rename remote file from
257.Ar oldpath
258to
Damien Millerd7686fd2001-02-10 00:40:03 +1100259.Ar newpath .
260.It Ic rmdir Ar path
Damien Miller33804262001-02-04 23:20:18 +1100261Remove remote directory specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100262.Ar path .
263.It Ic rm Ar path
Damien Miller33804262001-02-04 23:20:18 +1100264Delete remote file specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100265.Ar path .
Damien Miller058316f2001-03-08 10:08:49 +1100266.It Ic symlink Ar oldpath Ar newpath
Ben Lindstrom24643222001-06-25 05:08:11 +0000267Create a symbolic link from
Damien Miller058316f2001-03-08 10:08:49 +1100268.Ar oldpath
269to
270.Ar newpath .
Damien Miller63421802003-01-08 14:05:23 +1100271.It Ic version
272Display the
273.Nm
274protocol version.
Damien Miller33804262001-02-04 23:20:18 +1100275.It Ic ! Ar command
Ben Lindstrom24643222001-06-25 05:08:11 +0000276Execute
Damien Miller33804262001-02-04 23:20:18 +1100277.Ar command
Damien Millerd7686fd2001-02-10 00:40:03 +1100278in local shell.
Damien Miller33804262001-02-04 23:20:18 +1100279.It Ic !
Damien Millerd7686fd2001-02-10 00:40:03 +1100280Escape to local shell.
281.It Ic ?
282Synonym for help.
283.El
Damien Miller33804262001-02-04 23:20:18 +1100284.Sh AUTHORS
285Damien Miller <djm@mindrot.org>
286.Sh SEE ALSO
Ben Lindstrom160ec622001-04-22 17:17:46 +0000287.Xr scp 1 ,
Damien Miller33804262001-02-04 23:20:18 +1100288.Xr ssh 1 ,
289.Xr ssh-add 1 ,
290.Xr ssh-keygen 1 ,
Ben Lindstrom3072aae2002-06-21 01:02:39 +0000291.Xr ssh_config 5 ,
Ben Lindstrom160ec622001-04-22 17:17:46 +0000292.Xr sftp-server 8 ,
293.Xr sshd 8
294.Rs
Ben Lindstrom90fd0602001-06-25 04:45:33 +0000295.%A T. Ylonen
296.%A S. Lehtinen
Ben Lindstrom160ec622001-04-22 17:17:46 +0000297.%T "SSH File Transfer Protocol"
298.%N draft-ietf-secsh-filexfer-00.txt
299.%D January 2001
300.%O work in progress material
301.Re