sftp.0 revision 197670
1SFTP(1) OpenBSD Reference Manual SFTP(1) 2 3NAME 4 sftp - secure file transfer program 5 6SYNOPSIS 7 sftp [-1Cv] [-B buffer_size] [-b batchfile] [-F ssh_config] 8 [-o ssh_option] [-P sftp_server_path] [-R num_requests] [-S program] 9 [-s subsystem | sftp_server] host 10 sftp [user@]host[:file ...] 11 sftp [user@]host[:dir[/]] 12 sftp -b batchfile [user@]host 13 14DESCRIPTION 15 sftp is an interactive file transfer program, similar to ftp(1), which 16 performs all operations over an encrypted ssh(1) transport. It may also 17 use many features of ssh, such as public key authentication and compres- 18 sion. sftp connects and logs into the specified host, then enters an in- 19 teractive command mode. 20 21 The second usage format will retrieve files automatically if a non-inter- 22 active authentication method is used; otherwise it will do so after suc- 23 cessful interactive authentication. 24 25 The third usage format allows sftp to start in a remote directory. 26 27 The final usage format allows for automated sessions using the -b option. 28 In such cases, it is necessary to configure non-interactive authentica- 29 tion to obviate the need to enter a password at connection time (see 30 sshd(8) and ssh-keygen(1) for details). The options are as follows: 31 32 -1 Specify the use of protocol version 1. 33 34 -B buffer_size 35 Specify the size of the buffer that sftp uses when transferring 36 files. Larger buffers require fewer round trips at the cost of 37 higher memory consumption. The default is 32768 bytes. 38 39 -b batchfile 40 Batch mode reads a series of commands from an input batchfile in- 41 stead of stdin. Since it lacks user interaction it should be 42 used in conjunction with non-interactive authentication. A 43 batchfile of `-' may be used to indicate standard input. sftp 44 will abort if any of the following commands fail: get, put, 45 rename, ln, rm, mkdir, chdir, ls, lchdir, chmod, chown, chgrp, 46 lpwd, df, and lmkdir. Termination on error can be suppressed on 47 a command by command basis by prefixing the command with a `-' 48 character (for example, -rm /tmp/blah*). 49 50 -C Enables compression (via ssh's -C flag). 51 52 -F ssh_config 53 Specifies an alternative per-user configuration file for ssh(1). 54 This option is directly passed to ssh(1). 55 56 -o ssh_option 57 Can be used to pass options to ssh in the format used in 58 ssh_config(5). This is useful for specifying options for which 59 there is no separate sftp command-line flag. For example, to 60 specify an alternate port use: sftp -oPort=24. For full details 61 of the options listed below, and their possible values, see 62 ssh_config(5). 63 64 AddressFamily 65 BatchMode 66 BindAddress 67 ChallengeResponseAuthentication 68 CheckHostIP 69 Cipher 70 Ciphers 71 Compression 72 CompressionLevel 73 ConnectionAttempts 74 ConnectTimeout 75 ControlMaster 76 ControlPath 77 GlobalKnownHostsFile 78 GSSAPIAuthentication 79 GSSAPIDelegateCredentials 80 HashKnownHosts 81 Host 82 HostbasedAuthentication 83 HostKeyAlgorithms 84 HostKeyAlias 85 HostName 86 IdentityFile 87 IdentitiesOnly 88 KbdInteractiveDevices 89 LogLevel 90 MACs 91 NoHostAuthenticationForLocalhost 92 NumberOfPasswordPrompts 93 PasswordAuthentication 94 Port 95 PreferredAuthentications 96 Protocol 97 ProxyCommand 98 PubkeyAuthentication 99 RekeyLimit 100 RhostsRSAAuthentication 101 RSAAuthentication 102 SendEnv 103 ServerAliveInterval 104 ServerAliveCountMax 105 SmartcardDevice 106 StrictHostKeyChecking 107 TCPKeepAlive 108 UsePrivilegedPort 109 User 110 UserKnownHostsFile 111 VerifyHostKeyDNS 112 113 -P sftp_server_path 114 Connect directly to a local sftp server (rather than via ssh(1)). 115 This option may be useful in debugging the client and server. 116 117 -R num_requests 118 Specify how many requests may be outstanding at any one time. 119 Increasing this may slightly improve file transfer speed but will 120 increase memory usage. The default is 64 outstanding requests. 121 122 -S program 123 Name of the program to use for the encrypted connection. The 124 program must understand ssh(1) options. 125 126 -s subsystem | sftp_server 127 Specifies the SSH2 subsystem or the path for an sftp server on 128 the remote host. A path is useful for using sftp over protocol 129 version 1, or when the remote sshd(8) does not have an sftp sub- 130 system configured. 131 132 -v Raise logging level. This option is also passed to ssh. 133 134INTERACTIVE COMMANDS 135 Once in interactive mode, sftp understands a set of commands similar to 136 those of ftp(1). Commands are case insensitive. Pathnames that contain 137 spaces must be enclosed in quotes. Any special characters contained 138 within pathnames that are recognized by glob(3) must be escaped with 139 backslashes (`\'). 140 141 bye Quit sftp. 142 143 cd path 144 Change remote directory to path. 145 146 chgrp grp path 147 Change group of file path to grp. path may contain glob(3) char- 148 acters and may match multiple files. grp must be a numeric GID. 149 150 chmod mode path 151 Change permissions of file path to mode. path may contain 152 glob(3) characters and may match multiple files. 153 154 chown own path 155 Change owner of file path to own. path may contain glob(3) char- 156 acters and may match multiple files. own must be a numeric UID. 157 158 df [-hi] [path] 159 Display usage information for the filesystem holding the current 160 directory (or path if specified). If the -h flag is specified, 161 the capacity information will be displayed using "human-readable" 162 suffixes. The -i flag requests display of inode information in 163 addition to capacity information. This command is only supported 164 on servers that implement the ``statvfs@openssh.com'' extension. 165 166 exit Quit sftp. 167 168 get [-P] remote-path [local-path] 169 Retrieve the remote-path and store it on the local machine. If 170 the local path name is not specified, it is given the same name 171 it has on the remote machine. remote-path may contain glob(3) 172 characters and may match multiple files. If it does and local- 173 path is specified, then local-path must specify a directory. If 174 the -P flag is specified, then full file permissions and access 175 times are copied too. 176 177 help Display help text. 178 179 lcd path 180 Change local directory to path. 181 182 lls [ls-options [path]] 183 Display local directory listing of either path or current direc- 184 tory if path is not specified. ls-options may contain any flags 185 supported by the local system's ls(1) command. path may contain 186 glob(3) characters and may match multiple files. 187 188 lmkdir path 189 Create local directory specified by path. 190 191 ln oldpath newpath 192 Create a symbolic link from oldpath to newpath. 193 194 lpwd Print local working directory. 195 196 ls [-1aflnrSt] [path] 197 Display a remote directory listing of either path or the current 198 directory if path is not specified. path may contain glob(3) 199 characters and may match multiple files. 200 201 The following flags are recognized and alter the behaviour of ls 202 accordingly: 203 204 -1 Produce single columnar output. 205 206 -a List files beginning with a dot (`.'). 207 208 -f Do not sort the listing. The default sort order is lexi- 209 cographical. 210 211 -l Display additional details including permissions and own- 212 ership information. 213 214 -n Produce a long listing with user and group information 215 presented numerically. 216 217 -r Reverse the sort order of the listing. 218 219 -S Sort the listing by file size. 220 221 -t Sort the listing by last modification time. 222 223 lumask umask 224 Set local umask to umask. 225 226 mkdir path 227 Create remote directory specified by path. 228 229 progress 230 Toggle display of progress meter. 231 232 put [-P] local-path [remote-path] 233 Upload local-path and store it on the remote machine. If the re- 234 mote path name is not specified, it is given the same name it has 235 on the local machine. local-path may contain glob(3) characters 236 and may match multiple files. If it does and remote-path is 237 specified, then remote-path must specify a directory. If the -P 238 flag is specified, then the file's full permission and access 239 time are copied too. 240 241 pwd Display remote working directory. 242 243 quit Quit sftp. 244 245 rename oldpath newpath 246 Rename remote file from oldpath to newpath. 247 248 rm path 249 Delete remote file specified by path. 250 251 rmdir path 252 Remove remote directory specified by path. 253 254 symlink oldpath newpath 255 Create a symbolic link from oldpath to newpath. 256 257 version 258 Display the sftp protocol version. 259 260 !command 261 Execute command in local shell. 262 263 ! Escape to local shell. 264 265 ? Synonym for help. 266 267SEE ALSO 268 ftp(1), ls(1), scp(1), ssh(1), ssh-add(1), ssh-keygen(1), glob(3), 269 ssh_config(5), sftp-server(8), sshd(8) 270 271 T. Ylonen and S. Lehtinen, SSH File Transfer Protocol, draft-ietf-secsh- 272 filexfer-00.txt, January 2001, work in progress material. 273 274OpenBSD 4.6 December 9, 2008 5 275