blob: 756123628aac0e8a7252c678e5e59967a95b319a [file] [log] [blame]
Ben Lindstromaafff9c2001-05-06 03:01:02 +00001.\" $OpenBSD: sftp.1,v 1.18 2001/05/05 13:42:51 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
40.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 Lindstromaafff9c2001-05-06 03:01:02 +000055The second usage format will retrieve files automatically if a non-interactive
56authentication 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
71will abort if any of the following
Ben Lindstrom562c26b2001-03-07 01:26:48 +000072commands 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
77Enables compression (via ssh's
78.Fl C
79flag)
Damien Miller33804262001-02-04 23:20:18 +110080.It Fl o Ar ssh_option
81Specify an option to be directly passed to
82.Xr ssh 1 .
Ben Lindstromc9b6eab2001-03-07 01:29:17 +000083.It Fl v
84Raise logging level. This option is also passed to ssh.
Damien Miller33804262001-02-04 23:20:18 +110085.El
86.Sh INTERACTIVE COMMANDS
Damien Millerd7686fd2001-02-10 00:40:03 +110087Once in interactive mode,
88.Nm
Damien Miller33804262001-02-04 23:20:18 +110089understands a set of commands similar to those of
90.Xr ftp 1 .
Ben Lindstrom27cb1d02001-02-10 21:59:35 +000091Commands are case insensitive and pathnames may be enclosed in quotes if they
92contain spaces.
Damien Miller33804262001-02-04 23:20:18 +110093.Bl -tag -width Ds
Damien Millerd7686fd2001-02-10 00:40:03 +110094.It Ic cd Ar path
Damien Miller33804262001-02-04 23:20:18 +110095Change remote directory to
Damien Millerd7686fd2001-02-10 00:40:03 +110096.Ar path .
97.It Ic lcd Ar path
Damien Miller33804262001-02-04 23:20:18 +110098Change local directory to
Damien Millerd7686fd2001-02-10 00:40:03 +110099.Ar path .
100.It Ic chgrp Ar grp Ar path
Damien Miller33804262001-02-04 23:20:18 +1100101Change group of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100102.Ar path
103to
Damien Miller33804262001-02-04 23:20:18 +1100104.Ar grp .
105.Ar grp
Damien Millerd7686fd2001-02-10 00:40:03 +1100106must be a numeric GID.
107.It Ic chmod Ar mode Ar path
Damien Miller33804262001-02-04 23:20:18 +1100108Change permissions of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100109.Ar path
110to
111.Ar mode .
112.It Ic chown Ar own Ar path
Damien Miller33804262001-02-04 23:20:18 +1100113Change owner of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100114.Ar path
115to
Damien Miller33804262001-02-04 23:20:18 +1100116.Ar own .
117.Ar own
118must be a numeric UID.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000119.It Ic exit
120Quit sftp.
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000121.It Xo Ic get
122.Op Ar flags
123.Ar remote-path
124.Op Ar local-path
125.Xc
Damien Miller33804262001-02-04 23:20:18 +1100126Retrieve the
Damien Millerd7686fd2001-02-10 00:40:03 +1100127.Ar remote-path
Damien Miller33804262001-02-04 23:20:18 +1100128and store it on the local machine.
129If the local
Damien Millerd7686fd2001-02-10 00:40:03 +1100130path name is not specified, it is given the same name it has on the
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000131remote machine. If the
132.Fl P
133flag is specified, then the file's full permission and access time are
134copied too.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000135.It Ic help
136Display help text.
Damien Millerd7686fd2001-02-10 00:40:03 +1100137.It Ic lls Op Ar ls-options Op Ar path
Damien Miller33804262001-02-04 23:20:18 +1100138Display local directory listing of either
139.Ar path
140or current directory if
141.Ar path
Damien Millerd7686fd2001-02-10 00:40:03 +1100142is not specified.
143.It Ic lmkdir Ar path
Damien Miller33804262001-02-04 23:20:18 +1100144Create local directory specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100145.Ar path .
Damien Miller058316f2001-03-08 10:08:49 +1100146.It Ic ln Ar oldpath Ar newpath
147Create a symbolic link from
148.Ar oldpath
149to
150.Ar newpath .
Damien Millerd7686fd2001-02-10 00:40:03 +1100151.It Ic lpwd
152Print local working directory.
153.It Ic ls Op Ar path
Damien Miller33804262001-02-04 23:20:18 +1100154Display remote directory listing of either
155.Ar path
Damien Millerd7686fd2001-02-10 00:40:03 +1100156or current directory if
Damien Miller33804262001-02-04 23:20:18 +1100157.Ar path
Damien Millerd7686fd2001-02-10 00:40:03 +1100158is not specified.
159.It Ic lumask Ar umask
160Set local umask to
161.Ar umask .
162.It Ic mkdir Ar path
163Create remote directory specified by
164.Ar path .
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000165.It Xo Ic put
166.Op Ar flags
167.Ar local-path
168.Op Ar local-path
169.Xc
Damien Miller33804262001-02-04 23:20:18 +1100170Upload
Damien Millerd7686fd2001-02-10 00:40:03 +1100171.Ar local-path
Damien Miller058316f2001-03-08 10:08:49 +1100172and store it on the remote machine. If the remote path name is not
173specified, it is given the same name it has on the local machine. If the
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000174.Fl P
175flag is specified, then the file's full permission and access time are
176copied too.
Damien Millerd7686fd2001-02-10 00:40:03 +1100177.It Ic pwd
178Display remote working directory.
Damien Millerd7686fd2001-02-10 00:40:03 +1100179.It Ic quit
180Quit sftp.
181.It Ic rename Ar oldpath Ar newpath
Damien Miller33804262001-02-04 23:20:18 +1100182Rename remote file from
183.Ar oldpath
184to
Damien Millerd7686fd2001-02-10 00:40:03 +1100185.Ar newpath .
186.It Ic rmdir Ar path
Damien Miller33804262001-02-04 23:20:18 +1100187Remove remote directory specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100188.Ar path .
189.It Ic rm Ar path
Damien Miller33804262001-02-04 23:20:18 +1100190Delete remote file specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100191.Ar path .
Damien Miller058316f2001-03-08 10:08:49 +1100192.It Ic symlink Ar oldpath Ar newpath
193Create a symbolic link from
194.Ar oldpath
195to
196.Ar newpath .
Damien Miller33804262001-02-04 23:20:18 +1100197.It Ic ! Ar command
198Execute
199.Ar command
Damien Millerd7686fd2001-02-10 00:40:03 +1100200in local shell.
Damien Miller33804262001-02-04 23:20:18 +1100201.It Ic !
Damien Millerd7686fd2001-02-10 00:40:03 +1100202Escape to local shell.
203.It Ic ?
204Synonym for help.
205.El
Damien Miller33804262001-02-04 23:20:18 +1100206.Sh AUTHORS
207Damien Miller <djm@mindrot.org>
208.Sh SEE ALSO
Ben Lindstrom160ec622001-04-22 17:17:46 +0000209.Xr scp 1 ,
Damien Miller33804262001-02-04 23:20:18 +1100210.Xr ssh 1 ,
211.Xr ssh-add 1 ,
212.Xr ssh-keygen 1 ,
Ben Lindstrom160ec622001-04-22 17:17:46 +0000213.Xr sftp-server 8 ,
214.Xr sshd 8
215.Rs
216.%A T. Ylonen
217.%A S. Lehtinen
218.%T "SSH File Transfer Protocol"
219.%N draft-ietf-secsh-filexfer-00.txt
220.%D January 2001
221.%O work in progress material
222.Re