118de8d7fSPeter Avalos.\" 218de8d7fSPeter Avalos.\" scp.1 318de8d7fSPeter Avalos.\" 418de8d7fSPeter Avalos.\" Author: Tatu Ylonen <ylo@cs.hut.fi> 518de8d7fSPeter Avalos.\" 618de8d7fSPeter Avalos.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 718de8d7fSPeter Avalos.\" All rights reserved 818de8d7fSPeter Avalos.\" 918de8d7fSPeter Avalos.\" Created: Sun May 7 00:14:37 1995 ylo 1018de8d7fSPeter Avalos.\" 11*ba1276acSMatthew Dillon.\" $OpenBSD: scp.1,v 1.112 2022/12/16 07:13:22 djm Exp $ 1218de8d7fSPeter Avalos.\" 13*ba1276acSMatthew Dillon.Dd $Mdocdate: December 16 2022 $ 1418de8d7fSPeter Avalos.Dt SCP 1 1518de8d7fSPeter Avalos.Os 1618de8d7fSPeter Avalos.Sh NAME 1718de8d7fSPeter Avalos.Nm scp 180cbfa66cSDaniel Fojt.Nd OpenSSH secure file copy 1918de8d7fSPeter Avalos.Sh SYNOPSIS 2018de8d7fSPeter Avalos.Nm scp 2150a69bb5SSascha Wildner.Op Fl 346ABCOpqRrsTv 2218de8d7fSPeter Avalos.Op Fl c Ar cipher 2350a69bb5SSascha Wildner.Op Fl D Ar sftp_server_path 2418de8d7fSPeter Avalos.Op Fl F Ar ssh_config 2518de8d7fSPeter Avalos.Op Fl i Ar identity_file 26664f4763Szrj.Op Fl J Ar destination 2718de8d7fSPeter Avalos.Op Fl l Ar limit 2818de8d7fSPeter Avalos.Op Fl o Ar ssh_option 2918de8d7fSPeter Avalos.Op Fl P Ar port 3018de8d7fSPeter Avalos.Op Fl S Ar program 31*ba1276acSMatthew Dillon.Op Fl X Ar sftp_option 32664f4763Szrj.Ar source ... target 3318de8d7fSPeter Avalos.Sh DESCRIPTION 3418de8d7fSPeter Avalos.Nm 3518de8d7fSPeter Avaloscopies files between hosts on a network. 3650a69bb5SSascha Wildner.Pp 37*ba1276acSMatthew Dillon.Nm 38*ba1276acSMatthew Dillonuses the SFTP protocol over a 3918de8d7fSPeter Avalos.Xr ssh 1 40*ba1276acSMatthew Dillonconnection for data transfer, and uses the same authentication and provides 41*ba1276acSMatthew Dillonthe same security as a login session. 4250a69bb5SSascha Wildner.Pp 4318de8d7fSPeter Avalos.Nm 4418de8d7fSPeter Avaloswill ask for passwords or passphrases if they are needed for 4518de8d7fSPeter Avalosauthentication. 4618de8d7fSPeter Avalos.Pp 47664f4763SzrjThe 48664f4763Szrj.Ar source 49664f4763Szrjand 50664f4763Szrj.Ar target 51664f4763Szrjmay be specified as a local pathname, a remote host with optional path 52664f4763Szrjin the form 53664f4763Szrj.Sm off 54664f4763Szrj.Oo user @ Oc host : Op path , 55664f4763Szrj.Sm on 56664f4763Szrjor a URI in the form 57664f4763Szrj.Sm off 58664f4763Szrj.No scp:// Oo user @ Oc host Oo : port Oc Op / path . 59664f4763Szrj.Sm on 6018de8d7fSPeter AvalosLocal file names can be made explicit using absolute or relative pathnames 6118de8d7fSPeter Avalosto avoid 6218de8d7fSPeter Avalos.Nm 6318de8d7fSPeter Avalostreating file names containing 6418de8d7fSPeter Avalos.Sq :\& 6518de8d7fSPeter Avalosas host specifiers. 66664f4763Szrj.Pp 67664f4763SzrjWhen copying between two remote hosts, if the URI format is used, a 68664f4763Szrj.Ar port 6950a69bb5SSascha Wildnercannot be specified on the 70664f4763Szrj.Ar target 71664f4763Szrjif the 7250a69bb5SSascha Wildner.Fl R 73664f4763Szrjoption is used. 7418de8d7fSPeter Avalos.Pp 7518de8d7fSPeter AvalosThe options are as follows: 7618de8d7fSPeter Avalos.Bl -tag -width Ds 779f304aafSPeter Avalos.It Fl 3 789f304aafSPeter AvalosCopies between two remote hosts are transferred through the local host. 799f304aafSPeter AvalosWithout this option the data is copied directly between the two remote 809f304aafSPeter Avaloshosts. 81ee116499SAntonio Huete JimenezNote that, when using the legacy SCP protocol (via the 82ee116499SAntonio Huete Jimenez.Fl O 83ee116499SAntonio Huete Jimenezflag), this option 8450a69bb5SSascha Wildnerselects batch mode for the second host as 850cbfa66cSDaniel Fojt.Nm 860cbfa66cSDaniel Fojtcannot ask for passwords or passphrases for both hosts. 8750a69bb5SSascha WildnerThis mode is the default. 8818de8d7fSPeter Avalos.It Fl 4 8918de8d7fSPeter AvalosForces 9018de8d7fSPeter Avalos.Nm 9118de8d7fSPeter Avalosto use IPv4 addresses only. 9218de8d7fSPeter Avalos.It Fl 6 9318de8d7fSPeter AvalosForces 9418de8d7fSPeter Avalos.Nm 9518de8d7fSPeter Avalosto use IPv6 addresses only. 9650a69bb5SSascha Wildner.It Fl A 9750a69bb5SSascha WildnerAllows forwarding of 9850a69bb5SSascha Wildner.Xr ssh-agent 1 9950a69bb5SSascha Wildnerto the remote system. 10050a69bb5SSascha WildnerThe default is not to forward an authentication agent. 10118de8d7fSPeter Avalos.It Fl B 10218de8d7fSPeter AvalosSelects batch mode (prevents asking for passwords or passphrases). 10318de8d7fSPeter Avalos.It Fl C 10418de8d7fSPeter AvalosCompression enable. 10518de8d7fSPeter AvalosPasses the 10618de8d7fSPeter Avalos.Fl C 10718de8d7fSPeter Avalosflag to 10818de8d7fSPeter Avalos.Xr ssh 1 10918de8d7fSPeter Avalosto enable compression. 11018de8d7fSPeter Avalos.It Fl c Ar cipher 11118de8d7fSPeter AvalosSelects the cipher to use for encrypting the data transfer. 11218de8d7fSPeter AvalosThis option is directly passed to 11318de8d7fSPeter Avalos.Xr ssh 1 . 11450a69bb5SSascha Wildner.It Fl D Ar sftp_server_path 115*ba1276acSMatthew DillonConnect directly to a local SFTP server program rather than a 11650a69bb5SSascha Wildnerremote one via 11750a69bb5SSascha Wildner.Xr ssh 1 . 11850a69bb5SSascha WildnerThis option may be useful in debugging the client and server. 11918de8d7fSPeter Avalos.It Fl F Ar ssh_config 12018de8d7fSPeter AvalosSpecifies an alternative 12118de8d7fSPeter Avalosper-user configuration file for 12218de8d7fSPeter Avalos.Nm ssh . 12318de8d7fSPeter AvalosThis option is directly passed to 12418de8d7fSPeter Avalos.Xr ssh 1 . 12518de8d7fSPeter Avalos.It Fl i Ar identity_file 12618de8d7fSPeter AvalosSelects the file from which the identity (private key) for public key 12718de8d7fSPeter Avalosauthentication is read. 12818de8d7fSPeter AvalosThis option is directly passed to 12918de8d7fSPeter Avalos.Xr ssh 1 . 130664f4763Szrj.It Fl J Ar destination 131664f4763SzrjConnect to the target host by first making an 132664f4763Szrj.Nm 133664f4763Szrjconnection to the jump host described by 134664f4763Szrj.Ar destination 135664f4763Szrjand then establishing a TCP forwarding to the ultimate destination from 136664f4763Szrjthere. 137664f4763SzrjMultiple jump hops may be specified separated by comma characters. 138664f4763SzrjThis is a shortcut to specify a 139664f4763Szrj.Cm ProxyJump 140664f4763Szrjconfiguration directive. 141664f4763SzrjThis option is directly passed to 142664f4763Szrj.Xr ssh 1 . 14318de8d7fSPeter Avalos.It Fl l Ar limit 14418de8d7fSPeter AvalosLimits the used bandwidth, specified in Kbit/s. 14550a69bb5SSascha Wildner.It Fl O 146ee116499SAntonio Huete JimenezUse the legacy SCP protocol for file transfers instead of the SFTP protocol. 14750a69bb5SSascha WildnerForcing the use of the SCP protocol may be necessary for servers that do 14850a69bb5SSascha Wildnernot implement SFTP, for backwards-compatibility for particular filename 14950a69bb5SSascha Wildnerwildcard patterns and for expanding paths with a 15050a69bb5SSascha Wildner.Sq ~ 15150a69bb5SSascha Wildnerprefix for older SFTP servers. 15218de8d7fSPeter Avalos.It Fl o Ar ssh_option 15318de8d7fSPeter AvalosCan be used to pass options to 15418de8d7fSPeter Avalos.Nm ssh 15518de8d7fSPeter Avalosin the format used in 15618de8d7fSPeter Avalos.Xr ssh_config 5 . 15718de8d7fSPeter AvalosThis is useful for specifying options 15818de8d7fSPeter Avalosfor which there is no separate 15918de8d7fSPeter Avalos.Nm scp 16018de8d7fSPeter Avaloscommand-line flag. 16118de8d7fSPeter AvalosFor full details of the options listed below, and their possible values, see 16218de8d7fSPeter Avalos.Xr ssh_config 5 . 16318de8d7fSPeter Avalos.Pp 16418de8d7fSPeter Avalos.Bl -tag -width Ds -offset indent -compact 16518de8d7fSPeter Avalos.It AddressFamily 16618de8d7fSPeter Avalos.It BatchMode 16718de8d7fSPeter Avalos.It BindAddress 168664f4763Szrj.It BindInterface 16936e94dc5SPeter Avalos.It CanonicalDomains 17036e94dc5SPeter Avalos.It CanonicalizeFallbackLocal 17136e94dc5SPeter Avalos.It CanonicalizeHostname 17236e94dc5SPeter Avalos.It CanonicalizeMaxDots 17336e94dc5SPeter Avalos.It CanonicalizePermittedCNAMEs 174664f4763Szrj.It CASignatureAlgorithms 175e9778795SPeter Avalos.It CertificateFile 17618de8d7fSPeter Avalos.It CheckHostIP 17718de8d7fSPeter Avalos.It Ciphers 17818de8d7fSPeter Avalos.It Compression 17918de8d7fSPeter Avalos.It ConnectionAttempts 18018de8d7fSPeter Avalos.It ConnectTimeout 18118de8d7fSPeter Avalos.It ControlMaster 18218de8d7fSPeter Avalos.It ControlPath 18399e85e0dSPeter Avalos.It ControlPersist 18418de8d7fSPeter Avalos.It GlobalKnownHostsFile 18518de8d7fSPeter Avalos.It GSSAPIAuthentication 18618de8d7fSPeter Avalos.It GSSAPIDelegateCredentials 18718de8d7fSPeter Avalos.It HashKnownHosts 18818de8d7fSPeter Avalos.It Host 18950a69bb5SSascha Wildner.It HostbasedAcceptedAlgorithms 19018de8d7fSPeter Avalos.It HostbasedAuthentication 19118de8d7fSPeter Avalos.It HostKeyAlgorithms 19218de8d7fSPeter Avalos.It HostKeyAlias 1930cbfa66cSDaniel Fojt.It Hostname 19418de8d7fSPeter Avalos.It IdentitiesOnly 195e9778795SPeter Avalos.It IdentityAgent 196e9778795SPeter Avalos.It IdentityFile 1979f304aafSPeter Avalos.It IPQoS 19899e85e0dSPeter Avalos.It KbdInteractiveAuthentication 19918de8d7fSPeter Avalos.It KbdInteractiveDevices 2009f304aafSPeter Avalos.It KexAlgorithms 20150a69bb5SSascha Wildner.It KnownHostsCommand 20218de8d7fSPeter Avalos.It LogLevel 20318de8d7fSPeter Avalos.It MACs 20418de8d7fSPeter Avalos.It NoHostAuthenticationForLocalhost 20518de8d7fSPeter Avalos.It NumberOfPasswordPrompts 20618de8d7fSPeter Avalos.It PasswordAuthentication 207856ea928SPeter Avalos.It PKCS11Provider 20818de8d7fSPeter Avalos.It Port 20918de8d7fSPeter Avalos.It PreferredAuthentications 21018de8d7fSPeter Avalos.It ProxyCommand 211e9778795SPeter Avalos.It ProxyJump 21250a69bb5SSascha Wildner.It PubkeyAcceptedAlgorithms 21318de8d7fSPeter Avalos.It PubkeyAuthentication 21418de8d7fSPeter Avalos.It RekeyLimit 215ee116499SAntonio Huete Jimenez.It RequiredRSASize 21618de8d7fSPeter Avalos.It SendEnv 21718de8d7fSPeter Avalos.It ServerAliveInterval 21818de8d7fSPeter Avalos.It ServerAliveCountMax 219664f4763Szrj.It SetEnv 22018de8d7fSPeter Avalos.It StrictHostKeyChecking 22118de8d7fSPeter Avalos.It TCPKeepAlive 222e9778795SPeter Avalos.It UpdateHostKeys 22318de8d7fSPeter Avalos.It User 22418de8d7fSPeter Avalos.It UserKnownHostsFile 22518de8d7fSPeter Avalos.It VerifyHostKeyDNS 22618de8d7fSPeter Avalos.El 22718de8d7fSPeter Avalos.It Fl P Ar port 22818de8d7fSPeter AvalosSpecifies the port to connect to on the remote host. 22918de8d7fSPeter AvalosNote that this option is written with a capital 23018de8d7fSPeter Avalos.Sq P , 23118de8d7fSPeter Avalosbecause 23218de8d7fSPeter Avalos.Fl p 23350a69bb5SSascha Wildneris already reserved for preserving the times and mode bits of the file. 23418de8d7fSPeter Avalos.It Fl p 23550a69bb5SSascha WildnerPreserves modification times, access times, and file mode bits from the 23650a69bb5SSascha Wildnersource file. 23718de8d7fSPeter Avalos.It Fl q 23818de8d7fSPeter AvalosQuiet mode: disables the progress meter as well as warning and diagnostic 23918de8d7fSPeter Avalosmessages from 24018de8d7fSPeter Avalos.Xr ssh 1 . 24150a69bb5SSascha Wildner.It Fl R 24250a69bb5SSascha WildnerCopies between two remote hosts are performed by connecting to the origin 24350a69bb5SSascha Wildnerhost and executing 24450a69bb5SSascha Wildner.Nm 24550a69bb5SSascha Wildnerthere. 24650a69bb5SSascha WildnerThis requires that 24750a69bb5SSascha Wildner.Nm 24850a69bb5SSascha Wildnerrunning on the origin host can authenticate to the destination host without 24950a69bb5SSascha Wildnerrequiring a password. 25018de8d7fSPeter Avalos.It Fl r 25118de8d7fSPeter AvalosRecursively copy entire directories. 25218de8d7fSPeter AvalosNote that 25318de8d7fSPeter Avalos.Nm 25418de8d7fSPeter Avalosfollows symbolic links encountered in the tree traversal. 25518de8d7fSPeter Avalos.It Fl S Ar program 25618de8d7fSPeter AvalosName of 25718de8d7fSPeter Avalos.Ar program 25818de8d7fSPeter Avalosto use for the encrypted connection. 25918de8d7fSPeter AvalosThe program must understand 26018de8d7fSPeter Avalos.Xr ssh 1 26118de8d7fSPeter Avalosoptions. 262664f4763Szrj.It Fl T 263664f4763SzrjDisable strict filename checking. 264664f4763SzrjBy default when copying files from a remote host to a local directory 265664f4763Szrj.Nm 266664f4763Szrjchecks that the received filenames match those requested on the command-line 267664f4763Szrjto prevent the remote end from sending unexpected or unwanted files. 268664f4763SzrjBecause of differences in how various operating systems and shells interpret 269664f4763Szrjfilename wildcards, these checks may cause wanted files to be rejected. 270664f4763SzrjThis option disables these checks at the expense of fully trusting that 271664f4763Szrjthe server will not send unexpected filenames. 27218de8d7fSPeter Avalos.It Fl v 27318de8d7fSPeter AvalosVerbose mode. 27418de8d7fSPeter AvalosCauses 27518de8d7fSPeter Avalos.Nm 27618de8d7fSPeter Avalosand 27718de8d7fSPeter Avalos.Xr ssh 1 27818de8d7fSPeter Avalosto print debugging messages about their progress. 27918de8d7fSPeter AvalosThis is helpful in 28018de8d7fSPeter Avalosdebugging connection, authentication, and configuration problems. 281*ba1276acSMatthew Dillon.It Fl X Ar sftp_option 282*ba1276acSMatthew DillonSpecify an option that controls aspects of SFTP protocol behaviour. 283*ba1276acSMatthew DillonThe valid options are: 284*ba1276acSMatthew Dillon.Bl -tag -width Ds 285*ba1276acSMatthew Dillon.It Cm nrequests Ns = Ns Ar value 286*ba1276acSMatthew DillonControls how many concurrent SFTP read or write requests may be in progress 287*ba1276acSMatthew Dillonat any point in time during a download or upload. 288*ba1276acSMatthew DillonBy default 64 requests may be active concurrently. 289*ba1276acSMatthew Dillon.It Cm buffer Ns = Ns Ar value 290*ba1276acSMatthew DillonControls the maximum buffer size for a single SFTP read/write operation used 291*ba1276acSMatthew Dillonduring download or upload. 292*ba1276acSMatthew DillonBy default a 32KB buffer is used. 293*ba1276acSMatthew Dillon.El 29418de8d7fSPeter Avalos.El 2959f304aafSPeter Avalos.Sh EXIT STATUS 29618de8d7fSPeter Avalos.Ex -std scp 29718de8d7fSPeter Avalos.Sh SEE ALSO 29818de8d7fSPeter Avalos.Xr sftp 1 , 29918de8d7fSPeter Avalos.Xr ssh 1 , 30018de8d7fSPeter Avalos.Xr ssh-add 1 , 30118de8d7fSPeter Avalos.Xr ssh-agent 1 , 30218de8d7fSPeter Avalos.Xr ssh-keygen 1 , 30318de8d7fSPeter Avalos.Xr ssh_config 5 , 30450a69bb5SSascha Wildner.Xr sftp-server 8 , 30518de8d7fSPeter Avalos.Xr sshd 8 30618de8d7fSPeter Avalos.Sh HISTORY 30718de8d7fSPeter Avalos.Nm 30836e94dc5SPeter Avalosis based on the rcp program in 30936e94dc5SPeter Avalos.Bx 31036e94dc5SPeter Avalossource code from the Regents of the University of California. 311ee116499SAntonio Huete Jimenez.Pp 312ee116499SAntonio Huete JimenezSince OpenSSH 9.0, 313ee116499SAntonio Huete Jimenez.Nm 314ee116499SAntonio Huete Jimenezhas used the SFTP protocol for transfers by default. 31518de8d7fSPeter Avalos.Sh AUTHORS 31636e94dc5SPeter Avalos.An Timo Rinne Aq Mt tri@iki.fi 31736e94dc5SPeter Avalos.An Tatu Ylonen Aq Mt ylo@cs.hut.fi 31850a69bb5SSascha Wildner.Sh CAVEATS 319ee116499SAntonio Huete JimenezThe legacy SCP protocol (selected by the 320ee116499SAntonio Huete Jimenez.Fl O 321ee116499SAntonio Huete Jimenezflag) requires execution of the remote user's shell to perform 32250a69bb5SSascha Wildner.Xr glob 3 32350a69bb5SSascha Wildnerpattern matching. 32450a69bb5SSascha WildnerThis requires careful quoting of any characters that have special meaning to 32550a69bb5SSascha Wildnerthe remote shell, such as quote characters. 326