blob: 0cc4e2b63b22942a8d112b2aebfad48ab439ff6a [file] [log] [blame]
Ben Lindstrom6a337632001-09-18 05:47:32 +00001.\" $OpenBSD: sftp.1,v 1.26 2001/09/17 20:38:09 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
Ben Lindstrom6a337632001-09-18 05:47:32 +000033.Op Fl 1Cv
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 Lindstrom6a337632001-09-18 05:47:32 +000037.Op Fl s Ar subsystem | sftp_server
38.Op Fl S Ar program
39.Ar host
Ben Lindstrom63667f62001-04-13 00:00:14 +000040.Nm sftp
41.Op [\fIuser\fR@]\fIhost\fR[:\fIfile\fR [\fIfile\fR]]
42.Nm sftp
Ben Lindstrom24643222001-06-25 05:08:11 +000043.Op [\fIuser\fR@]\fIhost\fR[:\fIdir\fR[\fI/\fR]]
Damien Miller33804262001-02-04 23:20:18 +110044.Sh DESCRIPTION
45.Nm
46is an interactive file transfer program, similar to
47.Xr ftp 1 ,
48which performs all operations over an encrypted
49.Xr ssh 1
50transport.
51It may also use many features of ssh, such as public key authentication and
52compression.
53.Nm
54connects and logs into the specified
Ben Lindstromaafff9c2001-05-06 03:01:02 +000055.Ar host ,
Damien Miller33804262001-02-04 23:20:18 +110056then enters an interactive command mode.
57.Pp
Ben Lindstrom24643222001-06-25 05:08:11 +000058The second usage format will retrieve files automatically if a non-interactive
Ben Lindstromaafff9c2001-05-06 03:01:02 +000059authentication method is used; otherwise it will do so after
60successful interactive authentication.
Ben Lindstrom63667f62001-04-13 00:00:14 +000061.Pp
62The last usage format allows the sftp client to start in a remote directory.
63.Pp
Damien Miller33804262001-02-04 23:20:18 +110064The options are as follows:
65.Bl -tag -width Ds
Ben Lindstrom6a337632001-09-18 05:47:32 +000066.It Fl 1
67Specify the use of protocol version 1.
Ben Lindstrom562c26b2001-03-07 01:26:48 +000068.It Fl b Ar batchfile
69Batch mode reads a series of commands from an input
Ben Lindstrom283cb822001-03-09 00:09:02 +000070.Ar batchfile
Ben Lindstrom562c26b2001-03-07 01:26:48 +000071instead of
Ben Lindstrom283cb822001-03-09 00:09:02 +000072.Em stdin .
73Since it lacks user interaction it should be used in conjunction with
74non-interactive authentication.
75.Nm
Ben Lindstrom24643222001-06-25 05:08:11 +000076will abort if any of the following
77commands fail:
Ben Lindstrom283cb822001-03-09 00:09:02 +000078.Ic get , put , rename , ln , rm , mkdir , chdir , lchdir
Ben Lindstrom562c26b2001-03-07 01:26:48 +000079and
Ben Lindstrom283cb822001-03-09 00:09:02 +000080.Ic lmkdir .
Ben Lindstromc9b6eab2001-03-07 01:29:17 +000081.It Fl C
Ben Lindstrom24643222001-06-25 05:08:11 +000082Enables compression (via ssh's
Ben Lindstromc9b6eab2001-03-07 01:29:17 +000083.Fl C
Ben Lindstrom6a337632001-09-18 05:47:32 +000084flag).
Ben Lindstrom1e243242001-09-18 05:38:44 +000085.It Fl F Ar ssh_config
86Specifies an alternative
87per-user configuration file for
88.Nm ssh .
89This option is directly passed to
90.Xr ssh 1 .
Damien Miller33804262001-02-04 23:20:18 +110091.It Fl o Ar ssh_option
Ben Lindstrom14c62eb2001-08-15 23:25:46 +000092Can be used to pass options to
93.Nm ssh
94in the format used in the
95.Xr ssh 1
96configuration file. This is useful for specifying options
97for which there is no separate
98.Nm sftp
Ben Lindstrom6a337632001-09-18 05:47:32 +000099command-line flag. For example, to specify an alternate
100port use:
101.Ic sftp -oPort=24 .
102.It Fl s Ar subsystem | sftp_server
103Specifies the SSH2 subsystem or the path for an sftp server
104on the remote host. A path is useful for using sftp over
105protocol version 1, or when the remote
106.Nm sshd
107does not have an sftp subsystem configured.
108.It Fl S Ar program
109Name of the
110.Ar program
111to use for the encrypted connection.
112The program must understand
113.Xr ssh 1
114options.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000115.It Fl v
116Raise logging level. This option is also passed to ssh.
Damien Miller33804262001-02-04 23:20:18 +1100117.El
118.Sh INTERACTIVE COMMANDS
Damien Millerd7686fd2001-02-10 00:40:03 +1100119Once in interactive mode,
120.Nm
Ben Lindstrom24643222001-06-25 05:08:11 +0000121understands a set of commands similar to those of
Damien Miller33804262001-02-04 23:20:18 +1100122.Xr ftp 1 .
Ben Lindstrom27cb1d02001-02-10 21:59:35 +0000123Commands are case insensitive and pathnames may be enclosed in quotes if they
124contain spaces.
Damien Miller33804262001-02-04 23:20:18 +1100125.Bl -tag -width Ds
Ben Lindstrom59e12492001-08-15 23:22:56 +0000126.It Ic bye
127Quit sftp.
Damien Millerd7686fd2001-02-10 00:40:03 +1100128.It Ic cd Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000129Change remote directory to
Damien Millerd7686fd2001-02-10 00:40:03 +1100130.Ar path .
131.It Ic lcd Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000132Change local directory to
Damien Millerd7686fd2001-02-10 00:40:03 +1100133.Ar path .
134.It Ic chgrp Ar grp Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000135Change group of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100136.Ar path
137to
Damien Miller33804262001-02-04 23:20:18 +1100138.Ar grp .
139.Ar grp
Damien Millerd7686fd2001-02-10 00:40:03 +1100140must be a numeric GID.
141.It Ic chmod Ar mode Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000142Change permissions of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100143.Ar path
144to
145.Ar mode .
146.It Ic chown Ar own Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000147Change owner of file
Damien Millerd7686fd2001-02-10 00:40:03 +1100148.Ar path
149to
Damien Miller33804262001-02-04 23:20:18 +1100150.Ar own .
151.Ar own
152must be a numeric UID.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000153.It Ic exit
154Quit sftp.
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000155.It Xo Ic get
156.Op Ar flags
157.Ar remote-path
158.Op Ar local-path
159.Xc
Damien Miller33804262001-02-04 23:20:18 +1100160Retrieve the
Damien Millerd7686fd2001-02-10 00:40:03 +1100161.Ar remote-path
Damien Miller33804262001-02-04 23:20:18 +1100162and store it on the local machine.
163If the local
Ben Lindstrom24643222001-06-25 05:08:11 +0000164path name is not specified, it is given the same name it has on the
165remote machine. If the
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000166.Fl P
167flag is specified, then the file's full permission and access time are
168copied too.
Ben Lindstromc9b6eab2001-03-07 01:29:17 +0000169.It Ic help
170Display help text.
Damien Millerd7686fd2001-02-10 00:40:03 +1100171.It Ic lls Op Ar ls-options Op Ar path
Ben Lindstrom24643222001-06-25 05:08:11 +0000172Display local directory listing of either
Damien Miller33804262001-02-04 23:20:18 +1100173.Ar path
174or current directory if
175.Ar path
Damien Millerd7686fd2001-02-10 00:40:03 +1100176is not specified.
177.It Ic lmkdir Ar path
Damien Miller33804262001-02-04 23:20:18 +1100178Create local directory specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100179.Ar path .
Damien Miller058316f2001-03-08 10:08:49 +1100180.It Ic ln Ar oldpath Ar newpath
Ben Lindstrom24643222001-06-25 05:08:11 +0000181Create a symbolic link from
Damien Miller058316f2001-03-08 10:08:49 +1100182.Ar oldpath
183to
184.Ar newpath .
Damien Millerd7686fd2001-02-10 00:40:03 +1100185.It Ic lpwd
186Print local working directory.
187.It Ic ls Op Ar path
Damien Miller33804262001-02-04 23:20:18 +1100188Display remote directory listing of either
189.Ar path
Damien Millerd7686fd2001-02-10 00:40:03 +1100190or current directory if
Damien Miller33804262001-02-04 23:20:18 +1100191.Ar path
Damien Millerd7686fd2001-02-10 00:40:03 +1100192is not specified.
193.It Ic lumask Ar umask
Ben Lindstrom24643222001-06-25 05:08:11 +0000194Set local umask to
Damien Millerd7686fd2001-02-10 00:40:03 +1100195.Ar umask .
196.It Ic mkdir Ar path
197Create remote directory specified by
198.Ar path .
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000199.It Xo Ic put
200.Op Ar flags
201.Ar local-path
202.Op Ar local-path
203.Xc
Damien Miller33804262001-02-04 23:20:18 +1100204Upload
Damien Millerd7686fd2001-02-10 00:40:03 +1100205.Ar local-path
Ben Lindstrom24643222001-06-25 05:08:11 +0000206and store it on the remote machine. If the remote path name is not
207specified, it is given the same name it has on the local machine. If the
Ben Lindstrom9d4f2c82001-02-15 03:22:45 +0000208.Fl P
209flag is specified, then the file's full permission and access time are
210copied too.
Damien Millerd7686fd2001-02-10 00:40:03 +1100211.It Ic pwd
212Display remote working directory.
Damien Millerd7686fd2001-02-10 00:40:03 +1100213.It Ic quit
214Quit sftp.
215.It Ic rename Ar oldpath Ar newpath
Damien Miller33804262001-02-04 23:20:18 +1100216Rename remote file from
217.Ar oldpath
218to
Damien Millerd7686fd2001-02-10 00:40:03 +1100219.Ar newpath .
220.It Ic rmdir Ar path
Damien Miller33804262001-02-04 23:20:18 +1100221Remove remote directory specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100222.Ar path .
223.It Ic rm Ar path
Damien Miller33804262001-02-04 23:20:18 +1100224Delete remote file specified by
Damien Millerd7686fd2001-02-10 00:40:03 +1100225.Ar path .
Damien Miller058316f2001-03-08 10:08:49 +1100226.It Ic symlink Ar oldpath Ar newpath
Ben Lindstrom24643222001-06-25 05:08:11 +0000227Create a symbolic link from
Damien Miller058316f2001-03-08 10:08:49 +1100228.Ar oldpath
229to
230.Ar newpath .
Damien Miller33804262001-02-04 23:20:18 +1100231.It Ic ! Ar command
Ben Lindstrom24643222001-06-25 05:08:11 +0000232Execute
Damien Miller33804262001-02-04 23:20:18 +1100233.Ar command
Damien Millerd7686fd2001-02-10 00:40:03 +1100234in local shell.
Damien Miller33804262001-02-04 23:20:18 +1100235.It Ic !
Damien Millerd7686fd2001-02-10 00:40:03 +1100236Escape to local shell.
237.It Ic ?
238Synonym for help.
239.El
Damien Miller33804262001-02-04 23:20:18 +1100240.Sh AUTHORS
241Damien Miller <djm@mindrot.org>
242.Sh SEE ALSO
Ben Lindstrom160ec622001-04-22 17:17:46 +0000243.Xr scp 1 ,
Damien Miller33804262001-02-04 23:20:18 +1100244.Xr ssh 1 ,
245.Xr ssh-add 1 ,
246.Xr ssh-keygen 1 ,
Ben Lindstrom160ec622001-04-22 17:17:46 +0000247.Xr sftp-server 8 ,
248.Xr sshd 8
249.Rs
Ben Lindstrom90fd0602001-06-25 04:45:33 +0000250.%A T. Ylonen
251.%A S. Lehtinen
Ben Lindstrom160ec622001-04-22 17:17:46 +0000252.%T "SSH File Transfer Protocol"
253.%N draft-ietf-secsh-filexfer-00.txt
254.%D January 2001
255.%O work in progress material
256.Re