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