1.\" $OpenBSD: sftp.1,v 1.23 2001/08/14 17:54:29 stevesk Exp $ 2.\" 3.\" Copyright (c) 2001 Damien Miller. All rights reserved. 4.\" 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.\" 25.Dd February 4, 2001 26.Dt SFTP 1 27.Os 28.Sh NAME 29.Nm sftp 30.Nd Secure file transfer program 31.Sh SYNOPSIS 32.Nm sftp 33.Op Fl vC 34.Op Fl b Ar batchfile 35.Op Fl o Ar ssh_option 36.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]] 41.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 52.Ar host , 53then enters an interactive command mode. 54.Pp 55The second usage format will retrieve files automatically if a non-interactive 56authentication method is used; otherwise it will do so after 57successful interactive authentication. 58.Pp 59The last usage format allows the sftp client to start in a remote directory. 60.Pp 61The options are as follows: 62.Bl -tag -width Ds 63.It Fl b Ar batchfile 64Batch mode reads a series of commands from an input 65.Ar batchfile 66instead of 67.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 72commands fail: 73.Ic get , put , rename , ln , rm , mkdir , chdir , lchdir 74and 75.Ic lmkdir . 76.It Fl C 77Enables compression (via ssh's 78.Fl C 79flag) 80.It Fl o Ar ssh_option 81Can 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 . 91.It Fl v 92Raise logging level. This option is also passed to ssh. 93.El 94.Sh INTERACTIVE COMMANDS 95Once in interactive mode, 96.Nm 97understands a set of commands similar to those of 98.Xr ftp 1 . 99Commands are case insensitive and pathnames may be enclosed in quotes if they 100contain spaces. 101.Bl -tag -width Ds 102.It Ic bye 103Quit sftp. 104.It Ic cd Ar path 105Change remote directory to 106.Ar path . 107.It Ic lcd Ar path 108Change local directory to 109.Ar path . 110.It Ic chgrp Ar grp Ar path 111Change group of file 112.Ar path 113to 114.Ar grp . 115.Ar grp 116must be a numeric GID. 117.It Ic chmod Ar mode Ar path 118Change permissions of file 119.Ar path 120to 121.Ar mode . 122.It Ic chown Ar own Ar path 123Change owner of file 124.Ar path 125to 126.Ar own . 127.Ar own 128must be a numeric UID. 129.It Ic exit 130Quit sftp. 131.It Xo Ic get 132.Op Ar flags 133.Ar remote-path 134.Op Ar local-path 135.Xc 136Retrieve the 137.Ar remote-path 138and store it on the local machine. 139If the local 140path name is not specified, it is given the same name it has on the 141remote machine. If the 142.Fl P 143flag is specified, then the file's full permission and access time are 144copied too. 145.It Ic help 146Display help text. 147.It Ic lls Op Ar ls-options Op Ar path 148Display local directory listing of either 149.Ar path 150or current directory if 151.Ar path 152is not specified. 153.It Ic lmkdir Ar path 154Create local directory specified by 155.Ar path . 156.It Ic ln Ar oldpath Ar newpath 157Create a symbolic link from 158.Ar oldpath 159to 160.Ar newpath . 161.It Ic lpwd 162Print local working directory. 163.It Ic ls Op Ar path 164Display remote directory listing of either 165.Ar path 166or current directory if 167.Ar path 168is not specified. 169.It Ic lumask Ar umask 170Set local umask to 171.Ar umask . 172.It Ic mkdir Ar path 173Create remote directory specified by 174.Ar path . 175.It Xo Ic put 176.Op Ar flags 177.Ar local-path 178.Op Ar local-path 179.Xc 180Upload 181.Ar local-path 182and 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 184.Fl P 185flag is specified, then the file's full permission and access time are 186copied too. 187.It Ic pwd 188Display remote working directory. 189.It Ic quit 190Quit sftp. 191.It Ic rename Ar oldpath Ar newpath 192Rename remote file from 193.Ar oldpath 194to 195.Ar newpath . 196.It Ic rmdir Ar path 197Remove remote directory specified by 198.Ar path . 199.It Ic rm Ar path 200Delete remote file specified by 201.Ar path . 202.It Ic symlink Ar oldpath Ar newpath 203Create a symbolic link from 204.Ar oldpath 205to 206.Ar newpath . 207.It Ic ! Ar command 208Execute 209.Ar command 210in local shell. 211.It Ic ! 212Escape to local shell. 213.It Ic ? 214Synonym for help. 215.El 216.Sh AUTHORS 217Damien Miller <djm@mindrot.org> 218.Sh SEE ALSO 219.Xr scp 1 , 220.Xr ssh 1 , 221.Xr ssh-add 1 , 222.Xr ssh-keygen 1 , 223.Xr sftp-server 8 , 224.Xr sshd 8 225.Rs 226.%A T. Ylonen 227.%A S. Lehtinen 228.%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 233