blob: 25a9b8a4877ccd4a9e8e5917ad50ec4168d4851c [file] [log] [blame]
Ben Lindstrom14c62eb2001-08-15 23:25:46 +00001.\" $OpenBSD: sftp.1,v 1.23 2001/08/14 17:54:29 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
Damien Miller33804262001-02-04 23:20:18 +110035.Op Fl o Ar ssh_option
Ben Lindstrom63667f62001-04-13 00:00:14 +000036.Op Ar host
37.Nm sftp
38.Op [\fIuser\fR@]\fIhost\fR[:\fIfile\fR [\fIfile\fR]]
39.Nm sftp
Ben Lindstrom24643222001-06-25 05:08:11 +000040.Op [\fIuser\fR@]\fIhost\fR[:\fIdir\fR[\fI/\fR]]
Damien Miller33804262001-02-04 23:20:18 +110041.Sh DESCRIPTION
42.Nm
43is an interactive file transfer program, similar to
44.Xr ftp 1 ,
45which performs all operations over an encrypted
46.Xr ssh 1
47transport.
48It may also use many features of ssh, such as public key authentication and
49compression.
50.Nm
51connects and logs into the specified
Ben Lindstromaafff9c2001-05-06 03:01:02 +000052.Ar host ,
Damien Miller33804262001-02-04 23:20:18 +110053then enters an interactive command mode.
54.Pp
Ben Lindstrom24643222001-06-25 05:08:11 +000055The second usage format will retrieve files automatically if a non-interactive
Ben Lindstromaafff9c2001-05-06 03:01:02 +000056authentication method is used; otherwise it will do so after
57successful interactive authentication.
Ben Lindstrom63667f62001-04-13 00:00:14 +000058.Pp
59The last usage format allows the sftp client to start in a remote directory.
60.Pp
Damien Miller33804262001-02-04 23:20:18 +110061The options are as follows:
62.Bl -tag -width Ds
Ben Lindstrom562c26b2001-03-07 01:26:48 +000063.It Fl b Ar batchfile
64Batch mode reads a series of commands from an input
Ben Lindstrom283cb822001-03-09 00:09:02 +000065.Ar batchfile
Ben Lindstrom562c26b2001-03-07 01:26:48 +000066instead of
Ben Lindstrom283cb822001-03-09 00:09:02 +000067.Em stdin .
68Since it lacks user interaction it should be used in conjunction with
69non-interactive authentication.
70.Nm
Ben Lindstrom24643222001-06-25 05:08:11 +000071will abort if any of the following
72commands fail:
Ben Lindstrom283cb822001-03-09 00:09:02 +000073.Ic get , put , rename , ln , rm , mkdir , chdir , lchdir
Ben Lindstrom562c26b2001-03-07 01:26:48 +000074and
Ben Lindstrom283cb822001-03-09 00:09:02 +000075.Ic lmkdir .
Ben Lindstromc9b6eab2001-03-07 01:29:17 +000076.It Fl C
Ben Lindstrom24643222001-06-25 05:08:11 +000077Enables compression (via ssh's
Ben Lindstromc9b6eab2001-03-07 01:29:17 +000078.Fl C
79flag)
Damien Miller33804262001-02-04 23:20:18 +110080.It Fl o Ar ssh_option
Ben Lindstrom14c62eb2001-08-15 23:25:46 +000081Can be used to pass options to
82.Nm ssh
83in the format used in the
84.Xr ssh 1
85configuration file. This is useful for specifying options
86for which there is no separate
87.Nm sftp
88command-line flag. For example, to force the use of protocol
89version 1 you may specify
90.Ic sftp -oProtocol=1 .
Ben Lindstromc9b6eab2001-03-07 01:29:17 +000091.It Fl v
92Raise logging level. This option is also passed to ssh.
Damien Miller33804262001-02-04 23:20:18 +110093.El
94.Sh INTERACTIVE COMMANDS
Damien Millerd7686fd2001-02-10 00:40:03 +110095Once in interactive mode,
96.Nm
Ben Lindstrom24643222001-06-25 05:08:11 +000097understands a set of commands similar to those of
Damien Miller33804262001-02-04 23:20:18 +110098.Xr ftp 1 .
Ben Lindstrom27cb1d02001-02-10 21:59:35 +000099Commands are case insensitive and pathnames may be enclosed in quotes if they
100contain spaces.
Damien Miller33804262001-02-04 23:20:18 +1100101.Bl -tag -width Ds
Ben Lindstrom59e12492001-08-15 23:22:56 +0000102.It Ic bye
103Quit sftp.
Damien Millerd7686fd2001-02-10 00:40:03 +1100104.It Ic cd Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000105Change remote directory to
Damien Millerd7686fd2001-02-10 00:40:03 +1100106.Ar path .
107.It Ic lcd Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000108Change local directory to
Damien Millerd7686fd2001-02-10 00:40:03 +1100109.Ar path .
110.It Ic chgrp Ar grp Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000111Change group of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100112.Ar path
113to
Damien Miller33804262001-02-04 23:20:18 +1100114.Ar grp .
115.Ar grp
Damien Millerd7686fd2001-02-10 00:40:03 +1100116must be a numeric GID.
117.It Ic chmod Ar mode Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000118Change permissions of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100119.Ar path
120to
121.Ar mode .
122.It Ic chown Ar own Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000123Change owner of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100124.Ar path
125to
Damien Miller33804262001-02-04 23:20:18 +1100126.Ar own .
127.Ar own
128must be a numeric UID.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000129.It Ic exit
130Quit sftp.
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000131.It Xo Ic get
132.Op Ar flags
133.Ar remote-path
134.Op Ar local-path
135.Xc
Damien Miller33804262001-02-04 23:20:18 +1100136Retrieve the
Damien Millerd7686fd2001-02-10 00:40:03 +1100137.Ar remote-path
Damien Miller33804262001-02-04 23:20:18 +1100138and store it on the local machine.
139If the local
Ben Lindstrom24643222001-06-25 05:08:11 +0000140path name is not specified, it is given the same name it has on the
141remote machine. If the
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000142.Fl P
143flag is specified, then the file's full permission and access time are
144copied too.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000145.It Ic help
146Display help text.
Damien Millerd7686fd2001-02-10 00:40:03 +1100147.It Ic lls Op Ar ls-options Op Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000148Display local directory listing of either
Damien Miller33804262001-02-04 23:20:18 +1100149.Ar path
150or current directory if
151.Ar path
Damien Millerd7686fd2001-02-10 00:40:03 +1100152is not specified.
153.It Ic lmkdir Ar path
Damien Miller33804262001-02-04 23:20:18 +1100154Create local directory specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100155.Ar path .
Damien Miller058316f2001-03-08 10:08:49 +1100156.It Ic ln Ar oldpath Ar newpath
Ben Lindstrom24643222001-06-25 05:08:11 +0000157Create a symbolic link from
Damien Miller058316f2001-03-08 10:08:49 +1100158.Ar oldpath
159to
160.Ar newpath .
Damien Millerd7686fd2001-02-10 00:40:03 +1100161.It Ic lpwd
162Print local working directory.
163.It Ic ls Op Ar path
Damien Miller33804262001-02-04 23:20:18 +1100164Display remote directory listing of either
165.Ar path
Damien Millerd7686fd2001-02-10 00:40:03 +1100166or current directory if
Damien Miller33804262001-02-04 23:20:18 +1100167.Ar path
Damien Millerd7686fd2001-02-10 00:40:03 +1100168is not specified.
169.It Ic lumask Ar umask
Ben Lindstrom24643222001-06-25 05:08:11 +0000170Set local umask to
Damien Millerd7686fd2001-02-10 00:40:03 +1100171.Ar umask .
172.It Ic mkdir Ar path
173Create remote directory specified by
174.Ar path .
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000175.It Xo Ic put
176.Op Ar flags
177.Ar local-path
178.Op Ar local-path
179.Xc
Damien Miller33804262001-02-04 23:20:18 +1100180Upload
Damien Millerd7686fd2001-02-10 00:40:03 +1100181.Ar local-path
Ben Lindstrom24643222001-06-25 05:08:11 +0000182and store it on the remote machine. If the remote path name is not
183specified, it is given the same name it has on the local machine. If the
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000184.Fl P
185flag is specified, then the file's full permission and access time are
186copied too.
Damien Millerd7686fd2001-02-10 00:40:03 +1100187.It Ic pwd
188Display remote working directory.
Damien Millerd7686fd2001-02-10 00:40:03 +1100189.It Ic quit
190Quit sftp.
191.It Ic rename Ar oldpath Ar newpath
Damien Miller33804262001-02-04 23:20:18 +1100192Rename remote file from
193.Ar oldpath
194to
Damien Millerd7686fd2001-02-10 00:40:03 +1100195.Ar newpath .
196.It Ic rmdir Ar path
Damien Miller33804262001-02-04 23:20:18 +1100197Remove remote directory specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100198.Ar path .
199.It Ic rm Ar path
Damien Miller33804262001-02-04 23:20:18 +1100200Delete remote file specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100201.Ar path .
Damien Miller058316f2001-03-08 10:08:49 +1100202.It Ic symlink Ar oldpath Ar newpath
Ben Lindstrom24643222001-06-25 05:08:11 +0000203Create a symbolic link from
Damien Miller058316f2001-03-08 10:08:49 +1100204.Ar oldpath
205to
206.Ar newpath .
Damien Miller33804262001-02-04 23:20:18 +1100207.It Ic ! Ar command
Ben Lindstrom24643222001-06-25 05:08:11 +0000208Execute
Damien Miller33804262001-02-04 23:20:18 +1100209.Ar command
Damien Millerd7686fd2001-02-10 00:40:03 +1100210in local shell.
Damien Miller33804262001-02-04 23:20:18 +1100211.It Ic !
Damien Millerd7686fd2001-02-10 00:40:03 +1100212Escape to local shell.
213.It Ic ?
214Synonym for help.
215.El
Damien Miller33804262001-02-04 23:20:18 +1100216.Sh AUTHORS
217Damien Miller <djm@mindrot.org>
218.Sh SEE ALSO
Ben Lindstrom160ec622001-04-22 17:17:46 +0000219.Xr scp 1 ,
Damien Miller33804262001-02-04 23:20:18 +1100220.Xr ssh 1 ,
221.Xr ssh-add 1 ,
222.Xr ssh-keygen 1 ,
Ben Lindstrom160ec622001-04-22 17:17:46 +0000223.Xr sftp-server 8 ,
224.Xr sshd 8
225.Rs
Ben Lindstrom90fd0602001-06-25 04:45:33 +0000226.%A T. Ylonen
227.%A S. Lehtinen
Ben Lindstrom160ec622001-04-22 17:17:46 +0000228.%T "SSH File Transfer Protocol"
229.%N draft-ietf-secsh-filexfer-00.txt
230.%D January 2001
231.%O work in progress material
232.Re