blob: 120e16897e5194749564851dcdb4f7552a2b576a [file] [log] [blame]
Ben Lindstrom1e243242001-09-18 05:38:44 +00001.\" $OpenBSD: sftp.1,v 1.25 2001/09/17 17:57:57 stevesk 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 Millerd7686fd2001-02-10 00:40:03 +110033.Op Fl vC
Ben Lindstrom562c26b2001-03-07 01:26:48 +000034.Op Fl b Ar batchfile
Ben Lindstrom1e243242001-09-18 05:38:44 +000035.Op Fl F Ar ssh_config
Damien Miller33804262001-02-04 23:20:18 +110036.Op Fl o Ar ssh_option
Ben Lindstrom63667f62001-04-13 00:00:14 +000037.Op Ar host
38.Nm sftp
39.Op [\fIuser\fR@]\fIhost\fR[:\fIfile\fR [\fIfile\fR]]
40.Nm sftp
Ben Lindstrom24643222001-06-25 05:08:11 +000041.Op [\fIuser\fR@]\fIhost\fR[:\fIdir\fR[\fI/\fR]]
Damien Miller33804262001-02-04 23:20:18 +110042.Sh DESCRIPTION
43.Nm
44is an interactive file transfer program, similar to
45.Xr ftp 1 ,
46which performs all operations over an encrypted
47.Xr ssh 1
48transport.
49It may also use many features of ssh, such as public key authentication and
50compression.
51.Nm
52connects and logs into the specified
Ben Lindstromaafff9c2001-05-06 03:01:02 +000053.Ar host ,
Damien Miller33804262001-02-04 23:20:18 +110054then enters an interactive command mode.
55.Pp
Ben Lindstrom24643222001-06-25 05:08:11 +000056The second usage format will retrieve files automatically if a non-interactive
Ben Lindstromaafff9c2001-05-06 03:01:02 +000057authentication method is used; otherwise it will do so after
58successful interactive authentication.
Ben Lindstrom63667f62001-04-13 00:00:14 +000059.Pp
60The last usage format allows the sftp client to start in a remote directory.
61.Pp
Damien Miller33804262001-02-04 23:20:18 +110062The options are as follows:
63.Bl -tag -width Ds
Ben Lindstrom562c26b2001-03-07 01:26:48 +000064.It Fl b Ar batchfile
65Batch mode reads a series of commands from an input
Ben Lindstrom283cb822001-03-09 00:09:02 +000066.Ar batchfile
Ben Lindstrom562c26b2001-03-07 01:26:48 +000067instead of
Ben Lindstrom283cb822001-03-09 00:09:02 +000068.Em stdin .
69Since it lacks user interaction it should be used in conjunction with
70non-interactive authentication.
71.Nm
Ben Lindstrom24643222001-06-25 05:08:11 +000072will abort if any of the following
73commands fail:
Ben Lindstrom283cb822001-03-09 00:09:02 +000074.Ic get , put , rename , ln , rm , mkdir , chdir , lchdir
Ben Lindstrom562c26b2001-03-07 01:26:48 +000075and
Ben Lindstrom283cb822001-03-09 00:09:02 +000076.Ic lmkdir .
Ben Lindstromc9b6eab2001-03-07 01:29:17 +000077.It Fl C
Ben Lindstrom24643222001-06-25 05:08:11 +000078Enables compression (via ssh's
Ben Lindstromc9b6eab2001-03-07 01:29:17 +000079.Fl C
80flag)
Ben Lindstrom1e243242001-09-18 05:38:44 +000081.It Fl F Ar ssh_config
82Specifies an alternative
83per-user configuration file for
84.Nm ssh .
85This option is directly passed to
86.Xr ssh 1 .
Damien Miller33804262001-02-04 23:20:18 +110087.It Fl o Ar ssh_option
Ben Lindstrom14c62eb2001-08-15 23:25:46 +000088Can be used to pass options to
89.Nm ssh
90in the format used in the
91.Xr ssh 1
92configuration file. This is useful for specifying options
93for which there is no separate
94.Nm sftp
Ben Lindstrom594e2032001-09-12 18:35:30 +000095command-line flag. For example, forcing the use of protocol
96version 1 is specified using
Ben Lindstrom14c62eb2001-08-15 23:25:46 +000097.Ic sftp -oProtocol=1 .
Ben Lindstromc9b6eab2001-03-07 01:29:17 +000098.It Fl v
99Raise logging level. This option is also passed to ssh.
Damien Miller33804262001-02-04 23:20:18 +1100100.El
101.Sh INTERACTIVE COMMANDS
Damien Millerd7686fd2001-02-10 00:40:03 +1100102Once in interactive mode,
103.Nm
Ben Lindstrom24643222001-06-25 05:08:11 +0000104understands a set of commands similar to those of
Damien Miller33804262001-02-04 23:20:18 +1100105.Xr ftp 1 .
Ben Lindstrom27cb1d02001-02-10 21:59:35 +0000106Commands are case insensitive and pathnames may be enclosed in quotes if they
107contain spaces.
Damien Miller33804262001-02-04 23:20:18 +1100108.Bl -tag -width Ds
Ben Lindstrom59e12492001-08-15 23:22:56 +0000109.It Ic bye
110Quit sftp.
Damien Millerd7686fd2001-02-10 00:40:03 +1100111.It Ic cd Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000112Change remote directory to
Damien Millerd7686fd2001-02-10 00:40:03 +1100113.Ar path .
114.It Ic lcd Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000115Change local directory to
Damien Millerd7686fd2001-02-10 00:40:03 +1100116.Ar path .
117.It Ic chgrp Ar grp Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000118Change group of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100119.Ar path
120to
Damien Miller33804262001-02-04 23:20:18 +1100121.Ar grp .
122.Ar grp
Damien Millerd7686fd2001-02-10 00:40:03 +1100123must be a numeric GID.
124.It Ic chmod Ar mode Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000125Change permissions of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100126.Ar path
127to
128.Ar mode .
129.It Ic chown Ar own Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000130Change owner of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100131.Ar path
132to
Damien Miller33804262001-02-04 23:20:18 +1100133.Ar own .
134.Ar own
135must be a numeric UID.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000136.It Ic exit
137Quit sftp.
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000138.It Xo Ic get
139.Op Ar flags
140.Ar remote-path
141.Op Ar local-path
142.Xc
Damien Miller33804262001-02-04 23:20:18 +1100143Retrieve the
Damien Millerd7686fd2001-02-10 00:40:03 +1100144.Ar remote-path
Damien Miller33804262001-02-04 23:20:18 +1100145and store it on the local machine.
146If the local
Ben Lindstrom24643222001-06-25 05:08:11 +0000147path name is not specified, it is given the same name it has on the
148remote machine. If the
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000149.Fl P
150flag is specified, then the file's full permission and access time are
151copied too.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000152.It Ic help
153Display help text.
Damien Millerd7686fd2001-02-10 00:40:03 +1100154.It Ic lls Op Ar ls-options Op Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000155Display local directory listing of either
Damien Miller33804262001-02-04 23:20:18 +1100156.Ar path
157or current directory if
158.Ar path
Damien Millerd7686fd2001-02-10 00:40:03 +1100159is not specified.
160.It Ic lmkdir Ar path
Damien Miller33804262001-02-04 23:20:18 +1100161Create local directory specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100162.Ar path .
Damien Miller058316f2001-03-08 10:08:49 +1100163.It Ic ln Ar oldpath Ar newpath
Ben Lindstrom24643222001-06-25 05:08:11 +0000164Create a symbolic link from
Damien Miller058316f2001-03-08 10:08:49 +1100165.Ar oldpath
166to
167.Ar newpath .
Damien Millerd7686fd2001-02-10 00:40:03 +1100168.It Ic lpwd
169Print local working directory.
170.It Ic ls Op Ar path
Damien Miller33804262001-02-04 23:20:18 +1100171Display remote directory listing of either
172.Ar path
Damien Millerd7686fd2001-02-10 00:40:03 +1100173or current directory if
Damien Miller33804262001-02-04 23:20:18 +1100174.Ar path
Damien Millerd7686fd2001-02-10 00:40:03 +1100175is not specified.
176.It Ic lumask Ar umask
Ben Lindstrom24643222001-06-25 05:08:11 +0000177Set local umask to
Damien Millerd7686fd2001-02-10 00:40:03 +1100178.Ar umask .
179.It Ic mkdir Ar path
180Create remote directory specified by
181.Ar path .
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000182.It Xo Ic put
183.Op Ar flags
184.Ar local-path
185.Op Ar local-path
186.Xc
Damien Miller33804262001-02-04 23:20:18 +1100187Upload
Damien Millerd7686fd2001-02-10 00:40:03 +1100188.Ar local-path
Ben Lindstrom24643222001-06-25 05:08:11 +0000189and store it on the remote machine. If the remote path name is not
190specified, it is given the same name it has on the local machine. If the
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000191.Fl P
192flag is specified, then the file's full permission and access time are
193copied too.
Damien Millerd7686fd2001-02-10 00:40:03 +1100194.It Ic pwd
195Display remote working directory.
Damien Millerd7686fd2001-02-10 00:40:03 +1100196.It Ic quit
197Quit sftp.
198.It Ic rename Ar oldpath Ar newpath
Damien Miller33804262001-02-04 23:20:18 +1100199Rename remote file from
200.Ar oldpath
201to
Damien Millerd7686fd2001-02-10 00:40:03 +1100202.Ar newpath .
203.It Ic rmdir Ar path
Damien Miller33804262001-02-04 23:20:18 +1100204Remove remote directory specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100205.Ar path .
206.It Ic rm Ar path
Damien Miller33804262001-02-04 23:20:18 +1100207Delete remote file specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100208.Ar path .
Damien Miller058316f2001-03-08 10:08:49 +1100209.It Ic symlink Ar oldpath Ar newpath
Ben Lindstrom24643222001-06-25 05:08:11 +0000210Create a symbolic link from
Damien Miller058316f2001-03-08 10:08:49 +1100211.Ar oldpath
212to
213.Ar newpath .
Damien Miller33804262001-02-04 23:20:18 +1100214.It Ic ! Ar command
Ben Lindstrom24643222001-06-25 05:08:11 +0000215Execute
Damien Miller33804262001-02-04 23:20:18 +1100216.Ar command
Damien Millerd7686fd2001-02-10 00:40:03 +1100217in local shell.
Damien Miller33804262001-02-04 23:20:18 +1100218.It Ic !
Damien Millerd7686fd2001-02-10 00:40:03 +1100219Escape to local shell.
220.It Ic ?
221Synonym for help.
222.El
Damien Miller33804262001-02-04 23:20:18 +1100223.Sh AUTHORS
224Damien Miller <djm@mindrot.org>
225.Sh SEE ALSO
Ben Lindstrom160ec622001-04-22 17:17:46 +0000226.Xr scp 1 ,
Damien Miller33804262001-02-04 23:20:18 +1100227.Xr ssh 1 ,
228.Xr ssh-add 1 ,
229.Xr ssh-keygen 1 ,
Ben Lindstrom160ec622001-04-22 17:17:46 +0000230.Xr sftp-server 8 ,
231.Xr sshd 8
232.Rs
Ben Lindstrom90fd0602001-06-25 04:45:33 +0000233.%A T. Ylonen
234.%A S. Lehtinen
Ben Lindstrom160ec622001-04-22 17:17:46 +0000235.%T "SSH File Transfer Protocol"
236.%N draft-ietf-secsh-filexfer-00.txt
237.%D January 2001
238.%O work in progress material
239.Re