1*c001be21Sws.\" $NetBSD: sftp.1,v 1.30 2023/12/01 12:07:19 ws Exp $ 2b1066cf3Schristos.\" $OpenBSD: sftp.1,v 1.143 2022/12/16 03:40:03 djm Exp $ 3ca32bd8dSchristos.\" 4ca32bd8dSchristos.\" Copyright (c) 2001 Damien Miller. All rights reserved. 5ca32bd8dSchristos.\" 6ca32bd8dSchristos.\" Redistribution and use in source and binary forms, with or without 7ca32bd8dSchristos.\" modification, are permitted provided that the following conditions 8ca32bd8dSchristos.\" are met: 9ca32bd8dSchristos.\" 1. Redistributions of source code must retain the above copyright 10ca32bd8dSchristos.\" notice, this list of conditions and the following disclaimer. 11ca32bd8dSchristos.\" 2. Redistributions in binary form must reproduce the above copyright 12ca32bd8dSchristos.\" notice, this list of conditions and the following disclaimer in the 13ca32bd8dSchristos.\" documentation and/or other materials provided with the distribution. 14ca32bd8dSchristos.\" 15ca32bd8dSchristos.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16ca32bd8dSchristos.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17ca32bd8dSchristos.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18ca32bd8dSchristos.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19ca32bd8dSchristos.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20ca32bd8dSchristos.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21ca32bd8dSchristos.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22ca32bd8dSchristos.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23ca32bd8dSchristos.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24ca32bd8dSchristos.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25ca32bd8dSchristos.\" 26b1066cf3Schristos.Dd December 16 2022 27ca32bd8dSchristos.Dt SFTP 1 28ca32bd8dSchristos.Os 29ca32bd8dSchristos.Sh NAME 30ca32bd8dSchristos.Nm sftp 31ed75d7a8Schristos.Nd OpenSSH secure file transfer 32ca32bd8dSchristos.Sh SYNOPSIS 33ca32bd8dSchristos.Nm sftp 342d3b0f52Schristos.Op Fl 46AaCfNpqrv 35ca32bd8dSchristos.Op Fl B Ar buffer_size 36ca32bd8dSchristos.Op Fl b Ar batchfile 3734b27b53Sadam.Op Fl c Ar cipher 38e160b4e8Schristos.Op Fl D Ar sftp_server_command 39ca32bd8dSchristos.Op Fl F Ar ssh_config 4034b27b53Sadam.Op Fl i Ar identity_file 41aa36fcacSchristos.Op Fl J Ar destination 42185c8f97Schristos.Op Fl l Ar limit 43ca32bd8dSchristos.Op Fl o Ar ssh_option 4434b27b53Sadam.Op Fl P Ar port 45ca32bd8dSchristos.Op Fl R Ar num_requests 46ca32bd8dSchristos.Op Fl S Ar program 47ca32bd8dSchristos.Op Fl s Ar subsystem | sftp_server 48b1066cf3Schristos.Op Fl X Ar sftp_option 49ffae97bbSchristos.Ar destination 50ca32bd8dSchristos.Sh DESCRIPTION 51ca32bd8dSchristos.Nm 52ffae97bbSchristosis a file transfer program, similar to 53ca32bd8dSchristos.Xr ftp 1 , 54ca32bd8dSchristoswhich performs all operations over an encrypted 55ca32bd8dSchristos.Xr ssh 1 56ca32bd8dSchristostransport. 57ca32bd8dSchristosIt may also use many features of ssh, such as public key authentication and 58ca32bd8dSchristoscompression. 59ca32bd8dSchristos.Pp 60ffae97bbSchristosThe 61ffae97bbSchristos.Ar destination 62ffae97bbSchristosmay be specified either as 63ffae97bbSchristos.Sm off 64ffae97bbSchristos.Oo user @ Oc host Op : path 65ffae97bbSchristos.Sm on 66ffae97bbSchristosor as a URI in the form 67ffae97bbSchristos.Sm off 68ffae97bbSchristos.No sftp:// Oo user @ Oc host Oo : port Oc Op / path . 69ffae97bbSchristos.Sm on 70ffae97bbSchristos.Pp 71ffae97bbSchristosIf the 72ffae97bbSchristos.Ar destination 73ffae97bbSchristosincludes a 74ffae97bbSchristos.Ar path 75ffae97bbSchristosand it is not a directory, 76ffae97bbSchristos.Nm 77ffae97bbSchristoswill retrieve files automatically if a non-interactive 78ca32bd8dSchristosauthentication method is used; otherwise it will do so after 79ca32bd8dSchristossuccessful interactive authentication. 80ca32bd8dSchristos.Pp 81ffae97bbSchristosIf no 82ffae97bbSchristos.Ar path 83ffae97bbSchristosis specified, or if the 84ffae97bbSchristos.Ar path 85ffae97bbSchristosis a directory, 86ca32bd8dSchristos.Nm 87ffae97bbSchristoswill log in to the specified 88ffae97bbSchristos.Ar host 89ffae97bbSchristosand enter interactive command mode, changing to the remote directory 90ffae97bbSchristosif one was specified. 91ffae97bbSchristosAn optional trailing slash can be used to force the 92ffae97bbSchristos.Ar path 93ffae97bbSchristosto be interpreted as a directory. 94ca32bd8dSchristos.Pp 95ffae97bbSchristosSince the destination formats use colon characters to delimit host 96ffae97bbSchristosnames from path names or port numbers, IPv6 addresses must be 97ffae97bbSchristosenclosed in square brackets to avoid ambiguity. 986f47b660Schristos.Pp 99ca32bd8dSchristosThe options are as follows: 100ca32bd8dSchristos.Bl -tag -width Ds 10134b27b53Sadam.It Fl 4 10234b27b53SadamForces 10334b27b53Sadam.Nm 10434b27b53Sadamto use IPv4 addresses only. 10534b27b53Sadam.It Fl 6 10634b27b53SadamForces 10734b27b53Sadam.Nm 10834b27b53Sadamto use IPv6 addresses only. 1092d3b0f52Schristos.It Fl A 1102d3b0f52SchristosAllows forwarding of 1112d3b0f52Schristos.Xr ssh-agent 1 1122d3b0f52Schristosto the remote system. 1132d3b0f52SchristosThe default is not to forward an authentication agent. 1148a4530f9Schristos.It Fl a 1158a4530f9SchristosAttempt to continue interrupted transfers rather than overwriting 1168a4530f9Schristosexisting partial or complete copies of files. 1178a4530f9SchristosIf the partial contents differ from those being transferred, 1188a4530f9Schristosthen the resultant file is likely to be corrupt. 119ca32bd8dSchristos.It Fl B Ar buffer_size 120ca32bd8dSchristosSpecify the size of the buffer that 121ca32bd8dSchristos.Nm 122ca32bd8dSchristosuses when transferring files. 123ca32bd8dSchristosLarger buffers require fewer round trips at the cost of higher 124ca32bd8dSchristosmemory consumption. 125ca32bd8dSchristosThe default is 32768 bytes. 126ca32bd8dSchristos.It Fl b Ar batchfile 127ca32bd8dSchristosBatch mode reads a series of commands from an input 128ca32bd8dSchristos.Ar batchfile 129ca32bd8dSchristosinstead of 130ca32bd8dSchristos.Em stdin . 131c4271af5SchristosSince it lacks user interaction, it should be used in conjunction with 132ffae97bbSchristosnon-interactive authentication to obviate the need to enter a password 133ffae97bbSchristosat connection time (see 134ffae97bbSchristos.Xr sshd 8 135ffae97bbSchristosand 136ffae97bbSchristos.Xr ssh-keygen 1 137ffae97bbSchristosfor details). 138aa36fcacSchristos.Pp 139ca32bd8dSchristosA 140ca32bd8dSchristos.Ar batchfile 141ca32bd8dSchristosof 142ca32bd8dSchristos.Sq \- 143ca32bd8dSchristosmay be used to indicate standard input. 144ca32bd8dSchristos.Nm 145ca32bd8dSchristoswill abort if any of the following 146ca32bd8dSchristoscommands fail: 1478a4530f9Schristos.Ic get , put , reget , reput , rename , ln , 148ca32bd8dSchristos.Ic rm , mkdir , chdir , ls , 149c4271af5Schristos.Ic lchdir , copy , cp , chmod , chown , 150185c8f97Schristos.Ic chgrp , lpwd , df , symlink , 151ca32bd8dSchristosand 152ca32bd8dSchristos.Ic lmkdir . 153aa36fcacSchristos.Pp 154ca32bd8dSchristosTermination on error can be suppressed on a command by command basis by 155ca32bd8dSchristosprefixing the command with a 156ca32bd8dSchristos.Sq \- 157ca32bd8dSchristoscharacter (for example, 158ca32bd8dSchristos.Ic -rm /tmp/blah* ) . 159aa36fcacSchristosEcho of the command may be suppressed by prefixing the command with a 160aa36fcacSchristos.Sq @ 161aa36fcacSchristoscharacter. 162aa36fcacSchristosThese two prefixes may be combined in any order, for example 163aa36fcacSchristos.Ic -@ls /bsd . 164ca32bd8dSchristos.It Fl C 165ca32bd8dSchristosEnables compression (via ssh's 166ca32bd8dSchristos.Fl C 167ca32bd8dSchristosflag). 16834b27b53Sadam.It Fl c Ar cipher 16934b27b53SadamSelects the cipher to use for encrypting the data transfers. 17034b27b53SadamThis option is directly passed to 17134b27b53Sadam.Xr ssh 1 . 172e160b4e8Schristos.It Fl D Ar sftp_server_command 17334b27b53SadamConnect directly to a local sftp server 17434b27b53Sadam(rather than via 17534b27b53Sadam.Xr ssh 1 ) . 176e160b4e8SchristosA command and arguments may be specified, for example 177e160b4e8Schristos.Qq /path/sftp-server -el debug3 . 17834b27b53SadamThis option may be useful in debugging the client and server. 179ca32bd8dSchristos.It Fl F Ar ssh_config 180ca32bd8dSchristosSpecifies an alternative 181ca32bd8dSchristosper-user configuration file for 182ca32bd8dSchristos.Xr ssh 1 . 183ca32bd8dSchristosThis option is directly passed to 184ca32bd8dSchristos.Xr ssh 1 . 1858a4530f9Schristos.It Fl f 1868a4530f9SchristosRequests that files be flushed to disk immediately after transfer. 1878a4530f9SchristosWhen uploading files, this feature is only enabled if the server 1888a4530f9Schristosimplements the "fsync@openssh.com" extension. 18934b27b53Sadam.It Fl i Ar identity_file 19034b27b53SadamSelects the file from which the identity (private key) for public key 19134b27b53Sadamauthentication is read. 19234b27b53SadamThis option is directly passed to 19334b27b53Sadam.Xr ssh 1 . 194aa36fcacSchristos.It Fl J Ar destination 195aa36fcacSchristosConnect to the target host by first making an 196aa36fcacSchristos.Nm 197aa36fcacSchristosconnection to the jump host described by 198aa36fcacSchristos.Ar destination 199aa36fcacSchristosand then establishing a TCP forwarding to the ultimate destination from 200aa36fcacSchristosthere. 201aa36fcacSchristosMultiple jump hops may be specified separated by comma characters. 202aa36fcacSchristosThis is a shortcut to specify a 203aa36fcacSchristos.Cm ProxyJump 204aa36fcacSchristosconfiguration directive. 205aa36fcacSchristosThis option is directly passed to 206aa36fcacSchristos.Xr ssh 1 . 207185c8f97Schristos.It Fl l Ar limit 208185c8f97SchristosLimits the used bandwidth, specified in Kbit/s. 2098db691beSchristos.It Fl N 2108db691beSchristosDisables quiet mode, e.g. to override the implicit quiet mode set by the 2118db691beSchristos.Fl b 2128db691beSchristosflag. 213ca32bd8dSchristos.It Fl o Ar ssh_option 214ca32bd8dSchristosCan be used to pass options to 215ca32bd8dSchristos.Nm ssh 216ca32bd8dSchristosin the format used in 217ca32bd8dSchristos.Xr ssh_config 5 . 218ca32bd8dSchristosThis is useful for specifying options 219ca32bd8dSchristosfor which there is no separate 220ca32bd8dSchristos.Nm sftp 221ca32bd8dSchristoscommand-line flag. 222ca32bd8dSchristosFor example, to specify an alternate port use: 223ca32bd8dSchristos.Ic sftp -oPort=24 . 224ca32bd8dSchristosFor full details of the options listed below, and their possible values, see 225ca32bd8dSchristos.Xr ssh_config 5 . 226ca32bd8dSchristos.Pp 227ca32bd8dSchristos.Bl -tag -width Ds -offset indent -compact 228ca32bd8dSchristos.It AddressFamily 229ca32bd8dSchristos.It BatchMode 230ca32bd8dSchristos.It BindAddress 231ffae97bbSchristos.It BindInterface 2328a4530f9Schristos.It CanonicalDomains 2338a4530f9Schristos.It CanonicalizeFallbackLocal 2348a4530f9Schristos.It CanonicalizeHostname 2358a4530f9Schristos.It CanonicalizeMaxDots 2368a4530f9Schristos.It CanonicalizePermittedCNAMEs 237aa36fcacSchristos.It CASignatureAlgorithms 23879976551Schristos.It CertificateFile 239ca32bd8dSchristos.It CheckHostIP 240ca32bd8dSchristos.It Ciphers 241ca32bd8dSchristos.It Compression 242ca32bd8dSchristos.It ConnectionAttempts 243ca32bd8dSchristos.It ConnectTimeout 244ca32bd8dSchristos.It ControlMaster 245ca32bd8dSchristos.It ControlPath 246091c4109Schristos.It ControlPersist 247ca32bd8dSchristos.It GlobalKnownHostsFile 248ca32bd8dSchristos.It GSSAPIAuthentication 249ca32bd8dSchristos.It GSSAPIDelegateCredentials 250ca32bd8dSchristos.It HashKnownHosts 251ca32bd8dSchristos.It Host 25217418e98Schristos.It HostbasedAcceptedAlgorithms 253ca32bd8dSchristos.It HostbasedAuthentication 254ca32bd8dSchristos.It HostKeyAlgorithms 255ca32bd8dSchristos.It HostKeyAlias 256cd4ada6aSchristos.It Hostname 257ca32bd8dSchristos.It IdentitiesOnly 2585101d403Schristos.It IdentityAgent 2595101d403Schristos.It IdentityFile 260185c8f97Schristos.It IPQoS 261*c001be21Sws.It IPv6PreferTemporary 262091c4109Schristos.It KbdInteractiveAuthentication 263ca32bd8dSchristos.It KbdInteractiveDevices 264185c8f97Schristos.It KexAlgorithms 26517418e98Schristos.It KnownHostsCommand 266ca32bd8dSchristos.It LogLevel 267ca32bd8dSchristos.It MACs 268ca32bd8dSchristos.It NoHostAuthenticationForLocalhost 269ca32bd8dSchristos.It NumberOfPasswordPrompts 270ca32bd8dSchristos.It PasswordAuthentication 27134b27b53Sadam.It PKCS11Provider 272ca32bd8dSchristos.It Port 273ca32bd8dSchristos.It PreferredAuthentications 274ca32bd8dSchristos.It ProxyCommand 2755101d403Schristos.It ProxyJump 27617418e98Schristos.It PubkeyAcceptedAlgorithms 277ca32bd8dSchristos.It PubkeyAuthentication 278ca32bd8dSchristos.It RekeyLimit 279e160b4e8Schristos.It RequiredRSASize 280ca32bd8dSchristos.It SendEnv 281ca32bd8dSchristos.It ServerAliveInterval 282ca32bd8dSchristos.It ServerAliveCountMax 28355a4608bSchristos.It SetEnv 284ca32bd8dSchristos.It StrictHostKeyChecking 285ca32bd8dSchristos.It TCPKeepAlive 286e4d43b82Schristos.It UpdateHostKeys 287ca32bd8dSchristos.It User 288ca32bd8dSchristos.It UserKnownHostsFile 289ca32bd8dSchristos.It VerifyHostKeyDNS 290ca32bd8dSchristos.El 29134b27b53Sadam.It Fl P Ar port 29234b27b53SadamSpecifies the port to connect to on the remote host. 29334b27b53Sadam.It Fl p 29434b27b53SadamPreserves modification times, access times, and modes from the 29534b27b53Sadamoriginal files transferred. 29634b27b53Sadam.It Fl q 29734b27b53SadamQuiet mode: disables the progress meter as well as warning and 29834b27b53Sadamdiagnostic messages from 29934b27b53Sadam.Xr ssh 1 . 300ca32bd8dSchristos.It Fl R Ar num_requests 301ca32bd8dSchristosSpecify how many requests may be outstanding at any one time. 302ca32bd8dSchristosIncreasing this may slightly improve file transfer speed 303ca32bd8dSchristosbut will increase memory usage. 304313c6c94SchristosThe default is 256 outstanding requests providing for 8MB 305313c6c94Schristosof outstanding data with a 32KB buffer. 30634b27b53Sadam.It Fl r 30734b27b53SadamRecursively copy entire directories when uploading and downloading. 30834b27b53SadamNote that 30934b27b53Sadam.Nm 31034b27b53Sadamdoes not follow symbolic links encountered in the tree traversal. 311ca32bd8dSchristos.It Fl S Ar program 312ca32bd8dSchristosName of the 313ca32bd8dSchristos.Ar program 314ca32bd8dSchristosto use for the encrypted connection. 315ca32bd8dSchristosThe program must understand 316ca32bd8dSchristos.Xr ssh 1 317ca32bd8dSchristosoptions. 318ca32bd8dSchristos.It Fl s Ar subsystem | sftp_server 319ca32bd8dSchristosSpecifies the SSH2 subsystem or the path for an sftp server 320ca32bd8dSchristoson the remote host. 3217a183406SchristosA path is useful when the remote 322ca32bd8dSchristos.Xr sshd 8 323ca32bd8dSchristosdoes not have an sftp subsystem configured. 324ca32bd8dSchristos.It Fl v 325ca32bd8dSchristosRaise logging level. 326ca32bd8dSchristosThis option is also passed to ssh. 327b1066cf3Schristos.It Fl X Ar sftp_option 328b1066cf3SchristosSpecify an option that controls aspects of SFTP protocol behaviour. 329b1066cf3SchristosThe valid options are: 330b1066cf3Schristos.Bl -tag -width Ds 331b1066cf3Schristos.It Cm nrequests Ns = Ns Ar value 332b1066cf3SchristosControls how many concurrent SFTP read or write requests may be in progress 333b1066cf3Schristosat any point in time during a download or upload. 334b1066cf3SchristosBy default 64 requests may be active concurrently. 335b1066cf3Schristos.It Cm buffer Ns = Ns Ar value 336b1066cf3SchristosControls the maximum buffer size for a single SFTP read/write operation used 337b1066cf3Schristosduring download or upload. 338b1066cf3SchristosBy default a 32KB buffer is used. 339b1066cf3Schristos.El 340ca32bd8dSchristos.El 341ca32bd8dSchristos.Sh INTERACTIVE COMMANDS 342ca32bd8dSchristosOnce in interactive mode, 343ca32bd8dSchristos.Nm 344ca32bd8dSchristosunderstands a set of commands similar to those of 345ca32bd8dSchristos.Xr ftp 1 . 346ca32bd8dSchristosCommands are case insensitive. 347ca32bd8dSchristosPathnames that contain spaces must be enclosed in quotes. 348ca32bd8dSchristosAny special characters contained within pathnames that are recognized by 349ca32bd8dSchristos.Xr glob 3 350ca32bd8dSchristosmust be escaped with backslashes 351ca32bd8dSchristos.Pq Sq \e . 352ca32bd8dSchristos.Bl -tag -width Ds 353ca32bd8dSchristos.It Ic bye 354ca32bd8dSchristosQuit 355ca32bd8dSchristos.Nm sftp . 356ffae97bbSchristos.It Ic cd Op Ar path 357ca32bd8dSchristosChange remote directory to 358ca32bd8dSchristos.Ar path . 359ffae97bbSchristosIf 360ffae97bbSchristos.Ar path 361ffae97bbSchristosis not specified, then change directory to the one the session started in. 362aa36fcacSchristos.It Xo Ic chgrp 363aa36fcacSchristos.Op Fl h 364aa36fcacSchristos.Ar grp 365aa36fcacSchristos.Ar path 366aa36fcacSchristos.Xc 367ca32bd8dSchristosChange group of file 368ca32bd8dSchristos.Ar path 369ca32bd8dSchristosto 370ca32bd8dSchristos.Ar grp . 371ca32bd8dSchristos.Ar path 372ca32bd8dSchristosmay contain 37355a4608bSchristos.Xr glob 7 374ca32bd8dSchristoscharacters and may match multiple files. 375ca32bd8dSchristos.Ar grp 376ca32bd8dSchristosmust be a numeric GID. 37717418e98Schristos.Pp 37817418e98SchristosIf the 37917418e98Schristos.Fl h 38017418e98Schristosflag is specified, then symlinks will not be followed. 38117418e98SchristosNote that this is only supported by servers that implement 38217418e98Schristosthe "lsetstat@openssh.com" extension. 383aa36fcacSchristos.It Xo Ic chmod 384aa36fcacSchristos.Op Fl h 385aa36fcacSchristos.Ar mode 386aa36fcacSchristos.Ar path 387aa36fcacSchristos.Xc 388ca32bd8dSchristosChange permissions of file 389ca32bd8dSchristos.Ar path 390ca32bd8dSchristosto 391ca32bd8dSchristos.Ar mode . 392ca32bd8dSchristos.Ar path 393ca32bd8dSchristosmay contain 39455a4608bSchristos.Xr glob 7 395ca32bd8dSchristoscharacters and may match multiple files. 39617418e98Schristos.Pp 39717418e98SchristosIf the 39817418e98Schristos.Fl h 39917418e98Schristosflag is specified, then symlinks will not be followed. 40017418e98SchristosNote that this is only supported by servers that implement 40117418e98Schristosthe "lsetstat@openssh.com" extension. 402aa36fcacSchristos.It Xo Ic chown 403aa36fcacSchristos.Op Fl h 404aa36fcacSchristos.Ar own 405aa36fcacSchristos.Ar path 406aa36fcacSchristos.Xc 407ca32bd8dSchristosChange owner of file 408ca32bd8dSchristos.Ar path 409ca32bd8dSchristosto 410ca32bd8dSchristos.Ar own . 411ca32bd8dSchristos.Ar path 412ca32bd8dSchristosmay contain 41355a4608bSchristos.Xr glob 7 414ca32bd8dSchristoscharacters and may match multiple files. 415ca32bd8dSchristos.Ar own 416ca32bd8dSchristosmust be a numeric UID. 41717418e98Schristos.Pp 41817418e98SchristosIf the 41917418e98Schristos.Fl h 42017418e98Schristosflag is specified, then symlinks will not be followed. 42117418e98SchristosNote that this is only supported by servers that implement 42217418e98Schristosthe "lsetstat@openssh.com" extension. 423c4271af5Schristos.It Ic copy Ar oldpath Ar newpath 424c4271af5SchristosCopy remote file from 425c4271af5Schristos.Ar oldpath 426c4271af5Schristosto 427c4271af5Schristos.Ar newpath . 428c4271af5Schristos.Pp 429c4271af5SchristosNote that this is only supported by servers that implement the "copy-data" 430c4271af5Schristosextension. 431c4271af5Schristos.It Ic cp Ar oldpath Ar newpath 432c4271af5SchristosAlias to 433c4271af5Schristos.Ic copy 434c4271af5Schristoscommand. 43517418e98Schristos.It Xo Ic df 43617418e98Schristos.Op Fl hi 43717418e98Schristos.Op Ar path 43817418e98Schristos.Xc 439ca32bd8dSchristosDisplay usage information for the filesystem holding the current directory 440ca32bd8dSchristos(or 441ca32bd8dSchristos.Ar path 442ca32bd8dSchristosif specified). 443ca32bd8dSchristosIf the 444ca32bd8dSchristos.Fl h 445ca32bd8dSchristosflag is specified, the capacity information will be displayed using 446ca32bd8dSchristos"human-readable" suffixes. 447ca32bd8dSchristosThe 448ca32bd8dSchristos.Fl i 449ca32bd8dSchristosflag requests display of inode information in addition to capacity information. 450ca32bd8dSchristosThis command is only supported on servers that implement the 451ca32bd8dSchristos.Dq statvfs@openssh.com 452ca32bd8dSchristosextension. 453ca32bd8dSchristos.It Ic exit 454ca32bd8dSchristosQuit 455ca32bd8dSchristos.Nm sftp . 45600a838c4Schristos.It Xo Ic get 457cd4ada6aSchristos.Op Fl afpR 45800a838c4Schristos.Ar remote-path 45900a838c4Schristos.Op Ar local-path 46000a838c4Schristos.Xc 461ca32bd8dSchristosRetrieve the 462834ba098Srin.Ar remote-path 463ca32bd8dSchristosand store it on the local machine. 464ca32bd8dSchristosIf the local 465ca32bd8dSchristospath name is not specified, it is given the same name it has on the 466ca32bd8dSchristosremote machine. 467ca32bd8dSchristos.Ar remote-path 468ca32bd8dSchristosmay contain 46955a4608bSchristos.Xr glob 7 470ca32bd8dSchristoscharacters and may match multiple files. 471ca32bd8dSchristosIf it does and 472ca32bd8dSchristos.Ar local-path 473ca32bd8dSchristosis specified, then 474ca32bd8dSchristos.Ar local-path 475ca32bd8dSchristosmust specify a directory. 47634b27b53Sadam.Pp 47700a838c4SchristosIf the 47800a838c4Schristos.Fl a 47900a838c4Schristosflag is specified, then attempt to resume partial transfers of existing files. 48000a838c4SchristosNote that resumption assumes that any partial copy of the local file matches 48100a838c4Schristosthe remote copy. 4828a4530f9SchristosIf the remote file contents differ from the partial local copy then the 4838a4530f9Schristosresultant file is likely to be corrupt. 4848a4530f9Schristos.Pp 4858a4530f9SchristosIf the 4868a4530f9Schristos.Fl f 4878a4530f9Schristosflag is specified, then 4888a4530f9Schristos.Xr fsync 2 4898a4530f9Schristoswill be called after the file transfer has completed to flush the file 4908a4530f9Schristosto disk. 49100a838c4Schristos.Pp 492cd4ada6aSchristosIf the 49334b27b53Sadam.Fl p 494cd4ada6aSchristos.\" undocumented redundant alias 495cd4ada6aSchristos.\" or 496cd4ada6aSchristos.\" .Fl P 497ca32bd8dSchristosflag is specified, then full file permissions and access times are 498ca32bd8dSchristoscopied too. 49934b27b53Sadam.Pp 50034b27b53SadamIf the 501cd4ada6aSchristos.Fl R 502cd4ada6aSchristos.\" undocumented redundant alias 503cd4ada6aSchristos.\" or 504cd4ada6aSchristos.\" .Fl r 50534b27b53Sadamflag is specified then directories will be copied recursively. 50634b27b53SadamNote that 50734b27b53Sadam.Nm 50834b27b53Sadamdoes not follow symbolic links when performing recursive transfers. 509ca32bd8dSchristos.It Ic help 510ca32bd8dSchristosDisplay help text. 511ffae97bbSchristos.It Ic lcd Op Ar path 512ca32bd8dSchristosChange local directory to 513ca32bd8dSchristos.Ar path . 514ffae97bbSchristosIf 515ffae97bbSchristos.Ar path 516ffae97bbSchristosis not specified, then change directory to the local user's home directory. 517ca32bd8dSchristos.It Ic lls Op Ar ls-options Op Ar path 518ca32bd8dSchristosDisplay local directory listing of either 519ca32bd8dSchristos.Ar path 520ca32bd8dSchristosor current directory if 521ca32bd8dSchristos.Ar path 522ca32bd8dSchristosis not specified. 523ca32bd8dSchristos.Ar ls-options 524ca32bd8dSchristosmay contain any flags supported by the local system's 525ca32bd8dSchristos.Xr ls 1 526ca32bd8dSchristoscommand. 527ca32bd8dSchristos.Ar path 528ca32bd8dSchristosmay contain 52955a4608bSchristos.Xr glob 7 530ca32bd8dSchristoscharacters and may match multiple files. 531ca32bd8dSchristos.It Ic lmkdir Ar path 532ca32bd8dSchristosCreate local directory specified by 533ca32bd8dSchristos.Ar path . 534185c8f97Schristos.It Xo Ic ln 535185c8f97Schristos.Op Fl s 536185c8f97Schristos.Ar oldpath 537185c8f97Schristos.Ar newpath 538185c8f97Schristos.Xc 539185c8f97SchristosCreate a link from 540ca32bd8dSchristos.Ar oldpath 541ca32bd8dSchristosto 542ca32bd8dSchristos.Ar newpath . 543185c8f97SchristosIf the 544185c8f97Schristos.Fl s 545185c8f97Schristosflag is specified the created link is a symbolic link, otherwise it is 546185c8f97Schristosa hard link. 547ca32bd8dSchristos.It Ic lpwd 548ca32bd8dSchristosPrint local working directory. 54934b27b53Sadam.It Ic ls Oo Fl 1afhlnrSt Oc Oo Ar path Oc 550ca32bd8dSchristosDisplay a remote directory listing of either 551ca32bd8dSchristos.Ar path 552ca32bd8dSchristosor the current directory if 553ca32bd8dSchristos.Ar path 554ca32bd8dSchristosis not specified. 555ca32bd8dSchristos.Ar path 556ca32bd8dSchristosmay contain 55755a4608bSchristos.Xr glob 7 558ca32bd8dSchristoscharacters and may match multiple files. 559ca32bd8dSchristos.Pp 560ca32bd8dSchristosThe following flags are recognized and alter the behaviour of 561ca32bd8dSchristos.Ic ls 562ca32bd8dSchristosaccordingly: 563ca32bd8dSchristos.Bl -tag -width Ds 564ca32bd8dSchristos.It Fl 1 565ca32bd8dSchristosProduce single columnar output. 566ca32bd8dSchristos.It Fl a 567ca32bd8dSchristosList files beginning with a dot 568ca32bd8dSchristos.Pq Sq \&. . 569ca32bd8dSchristos.It Fl f 570ca32bd8dSchristosDo not sort the listing. 571ca32bd8dSchristosThe default sort order is lexicographical. 57234b27b53Sadam.It Fl h 57334b27b53SadamWhen used with a long format option, use unit suffixes: Byte, Kilobyte, 57434b27b53SadamMegabyte, Gigabyte, Terabyte, Petabyte, and Exabyte in order to reduce 57534b27b53Sadamthe number of digits to four or fewer using powers of 2 for sizes (K=1024, 57634b27b53SadamM=1048576, etc.). 577ca32bd8dSchristos.It Fl l 578ca32bd8dSchristosDisplay additional details including permissions 579ca32bd8dSchristosand ownership information. 580ca32bd8dSchristos.It Fl n 581ca32bd8dSchristosProduce a long listing with user and group information presented 582ca32bd8dSchristosnumerically. 583ca32bd8dSchristos.It Fl r 584ca32bd8dSchristosReverse the sort order of the listing. 585ca32bd8dSchristos.It Fl S 586ca32bd8dSchristosSort the listing by file size. 587ca32bd8dSchristos.It Fl t 588ca32bd8dSchristosSort the listing by last modification time. 589ca32bd8dSchristos.El 590ca32bd8dSchristos.It Ic lumask Ar umask 591ca32bd8dSchristosSet local umask to 592ca32bd8dSchristos.Ar umask . 593ca32bd8dSchristos.It Ic mkdir Ar path 594ca32bd8dSchristosCreate remote directory specified by 595ca32bd8dSchristos.Ar path . 596ca32bd8dSchristos.It Ic progress 597ca32bd8dSchristosToggle display of progress meter. 5988a4530f9Schristos.It Xo Ic put 599cd4ada6aSchristos.Op Fl afpR 6008a4530f9Schristos.Ar local-path 6018a4530f9Schristos.Op Ar remote-path 6028a4530f9Schristos.Xc 603ca32bd8dSchristosUpload 604ca32bd8dSchristos.Ar local-path 605ca32bd8dSchristosand store it on the remote machine. 606ca32bd8dSchristosIf the remote path name is not specified, it is given the same name it has 607ca32bd8dSchristoson the local machine. 608ca32bd8dSchristos.Ar local-path 609ca32bd8dSchristosmay contain 61055a4608bSchristos.Xr glob 7 611ca32bd8dSchristoscharacters and may match multiple files. 612ca32bd8dSchristosIf it does and 613ca32bd8dSchristos.Ar remote-path 614ca32bd8dSchristosis specified, then 615ca32bd8dSchristos.Ar remote-path 616ca32bd8dSchristosmust specify a directory. 61734b27b53Sadam.Pp 6188a4530f9SchristosIf the 6198a4530f9Schristos.Fl a 6208a4530f9Schristosflag is specified, then attempt to resume partial 6218a4530f9Schristostransfers of existing files. 6228a4530f9SchristosNote that resumption assumes that any partial copy of the remote file 6238a4530f9Schristosmatches the local copy. 6248a4530f9SchristosIf the local file contents differ from the remote local copy then 6258a4530f9Schristosthe resultant file is likely to be corrupt. 6268a4530f9Schristos.Pp 6278a4530f9SchristosIf the 6288a4530f9Schristos.Fl f 6298a4530f9Schristosflag is specified, then a request will be sent to the server to call 6308a4530f9Schristos.Xr fsync 2 6318a4530f9Schristosafter the file has been transferred. 6328a4530f9SchristosNote that this is only supported by servers that implement 6338a4530f9Schristosthe "fsync@openssh.com" extension. 6348a4530f9Schristos.Pp 635cd4ada6aSchristosIf the 63634b27b53Sadam.Fl p 637cd4ada6aSchristos.\" undocumented redundant alias 638cd4ada6aSchristos.\" or 639cd4ada6aSchristos.\" .Fl P 64034b27b53Sadamflag is specified, then full file permissions and access times are 641ca32bd8dSchristoscopied too. 64234b27b53Sadam.Pp 64334b27b53SadamIf the 644cd4ada6aSchristos.Fl R 645cd4ada6aSchristos.\" undocumented redundant alias 646cd4ada6aSchristos.\" or 647cd4ada6aSchristos.\" .Fl r 64834b27b53Sadamflag is specified then directories will be copied recursively. 64934b27b53SadamNote that 65034b27b53Sadam.Nm 65134b27b53Sadamdoes not follow symbolic links when performing recursive transfers. 652ca32bd8dSchristos.It Ic pwd 653ca32bd8dSchristosDisplay remote working directory. 654ca32bd8dSchristos.It Ic quit 655ca32bd8dSchristosQuit 656ca32bd8dSchristos.Nm sftp . 65700a838c4Schristos.It Xo Ic reget 658cd4ada6aSchristos.Op Fl fpR 65900a838c4Schristos.Ar remote-path 66000a838c4Schristos.Op Ar local-path 66100a838c4Schristos.Xc 66200a838c4SchristosResume download of 66300a838c4Schristos.Ar remote-path . 66400a838c4SchristosEquivalent to 66500a838c4Schristos.Ic get 66600a838c4Schristoswith the 66700a838c4Schristos.Fl a 66800a838c4Schristosflag set. 6698a4530f9Schristos.It Xo Ic reput 670cd4ada6aSchristos.Op Fl fpR 671cd4ada6aSchristos.Ar local-path 672cd4ada6aSchristos.Op Ar remote-path 6738a4530f9Schristos.Xc 6748a4530f9SchristosResume upload of 675cd4ada6aSchristos.Ar local-path . 6768a4530f9SchristosEquivalent to 6778a4530f9Schristos.Ic put 6788a4530f9Schristoswith the 6798a4530f9Schristos.Fl a 6808a4530f9Schristosflag set. 6818db691beSchristos.It Ic rename Ar oldpath newpath 682ca32bd8dSchristosRename remote file from 683ca32bd8dSchristos.Ar oldpath 684ca32bd8dSchristosto 685ca32bd8dSchristos.Ar newpath . 686ca32bd8dSchristos.It Ic rm Ar path 687ca32bd8dSchristosDelete remote file specified by 688ca32bd8dSchristos.Ar path . 689ca32bd8dSchristos.It Ic rmdir Ar path 690ca32bd8dSchristosRemove remote directory specified by 691ca32bd8dSchristos.Ar path . 6928db691beSchristos.It Ic symlink Ar oldpath newpath 693ca32bd8dSchristosCreate a symbolic link from 694ca32bd8dSchristos.Ar oldpath 695ca32bd8dSchristosto 696ca32bd8dSchristos.Ar newpath . 697ca32bd8dSchristos.It Ic version 698ca32bd8dSchristosDisplay the 699ca32bd8dSchristos.Nm 700ca32bd8dSchristosprotocol version. 701ca32bd8dSchristos.It Ic \&! Ns Ar command 702ca32bd8dSchristosExecute 703ca32bd8dSchristos.Ar command 704ca32bd8dSchristosin local shell. 705ca32bd8dSchristos.It Ic \&! 706ca32bd8dSchristosEscape to local shell. 707ca32bd8dSchristos.It Ic \&? 708ca32bd8dSchristosSynonym for help. 709ca32bd8dSchristos.El 710ca32bd8dSchristos.Sh SEE ALSO 711ca32bd8dSchristos.Xr ftp 1 , 712ca32bd8dSchristos.Xr ls 1 , 713ca32bd8dSchristos.Xr scp 1 , 714ca32bd8dSchristos.Xr ssh 1 , 715ca32bd8dSchristos.Xr ssh-add 1 , 716ca32bd8dSchristos.Xr ssh-keygen 1 , 717ca32bd8dSchristos.Xr ssh_config 5 , 71855a4608bSchristos.Xr glob 7 , 719ca32bd8dSchristos.Xr sftp-server 8 , 720ca32bd8dSchristos.Xr sshd 8 721ca32bd8dSchristos.Rs 722ca32bd8dSchristos.%A T. Ylonen 723ca32bd8dSchristos.%A S. Lehtinen 724ca32bd8dSchristos.%T "SSH File Transfer Protocol" 725ca32bd8dSchristos.%N draft-ietf-secsh-filexfer-00.txt 726ca32bd8dSchristos.%D January 2001 727ca32bd8dSchristos.%O work in progress material 728ca32bd8dSchristos.Re 729