1.\" 2.\" scp.1 3.\" 4.\" Author: Tatu Ylonen <ylo@cs.hut.fi> 5.\" 6.\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 7.\" All rights reserved 8.\" 9.\" Created: Sun May 7 00:14:37 1995 ylo 10.\" 11.\" $OpenBSD: scp.1,v 1.105 2021/09/20 06:53:56 djm Exp $ 12.\" 13.Dd $Mdocdate: September 20 2021 $ 14.Dt SCP 1 15.Os 16.Sh NAME 17.Nm scp 18.Nd OpenSSH secure file copy 19.Sh SYNOPSIS 20.Nm scp 21.Op Fl 346ABCOpqRrsTv 22.Op Fl c Ar cipher 23.Op Fl D Ar sftp_server_path 24.Op Fl F Ar ssh_config 25.Op Fl i Ar identity_file 26.Op Fl J Ar destination 27.Op Fl l Ar limit 28.Op Fl o Ar ssh_option 29.Op Fl P Ar port 30.Op Fl S Ar program 31.Ar source ... target 32.Sh DESCRIPTION 33.Nm 34copies files between hosts on a network. 35.Pp 36It uses 37.Xr ssh 1 38for data transfer, and uses the same authentication and provides the 39same security as a login session. 40.Pp 41.Nm 42will ask for passwords or passphrases if they are needed for 43authentication. 44.Pp 45The 46.Ar source 47and 48.Ar target 49may be specified as a local pathname, a remote host with optional path 50in the form 51.Sm off 52.Oo user @ Oc host : Op path , 53.Sm on 54or a URI in the form 55.Sm off 56.No scp:// Oo user @ Oc host Oo : port Oc Op / path . 57.Sm on 58Local file names can be made explicit using absolute or relative pathnames 59to avoid 60.Nm 61treating file names containing 62.Sq :\& 63as host specifiers. 64.Pp 65When copying between two remote hosts, if the URI format is used, a 66.Ar port 67cannot be specified on the 68.Ar target 69if the 70.Fl R 71option is used. 72.Pp 73The options are as follows: 74.Bl -tag -width Ds 75.It Fl 3 76Copies between two remote hosts are transferred through the local host. 77Without this option the data is copied directly between the two remote 78hosts. 79Note that, when using the original SCP protocol (the default), this option 80selects batch mode for the second host as 81.Nm 82cannot ask for passwords or passphrases for both hosts. 83This mode is the default. 84.It Fl 4 85Forces 86.Nm 87to use IPv4 addresses only. 88.It Fl 6 89Forces 90.Nm 91to use IPv6 addresses only. 92.It Fl A 93Allows forwarding of 94.Xr ssh-agent 1 95to the remote system. 96The default is not to forward an authentication agent. 97.It Fl B 98Selects batch mode (prevents asking for passwords or passphrases). 99.It Fl C 100Compression enable. 101Passes the 102.Fl C 103flag to 104.Xr ssh 1 105to enable compression. 106.It Fl c Ar cipher 107Selects the cipher to use for encrypting the data transfer. 108This option is directly passed to 109.Xr ssh 1 . 110.It Fl D Ar sftp_server_path 111When using the SFTP protocol support via 112.Fl s , 113connect directly to a local SFTP server program rather than a 114remote one via 115.Xr ssh 1 . 116This option may be useful in debugging the client and server. 117.It Fl F Ar ssh_config 118Specifies an alternative 119per-user configuration file for 120.Nm ssh . 121This option is directly passed to 122.Xr ssh 1 . 123.It Fl i Ar identity_file 124Selects the file from which the identity (private key) for public key 125authentication is read. 126This option is directly passed to 127.Xr ssh 1 . 128.It Fl J Ar destination 129Connect to the target host by first making an 130.Nm 131connection to the jump host described by 132.Ar destination 133and then establishing a TCP forwarding to the ultimate destination from 134there. 135Multiple jump hops may be specified separated by comma characters. 136This is a shortcut to specify a 137.Cm ProxyJump 138configuration directive. 139This option is directly passed to 140.Xr ssh 1 . 141.It Fl l Ar limit 142Limits the used bandwidth, specified in Kbit/s. 143.It Fl O 144Use the original SCP protocol for file transfers instead of the SFTP protocol. 145Forcing the use of the SCP protocol may be necessary for servers that do 146not implement SFTP, for backwards-compatibility for particular filename 147wildcard patterns and for expanding paths with a 148.Sq ~ 149prefix for older SFTP servers. 150This mode is the default. 151.It Fl o Ar ssh_option 152Can be used to pass options to 153.Nm ssh 154in the format used in 155.Xr ssh_config 5 . 156This is useful for specifying options 157for which there is no separate 158.Nm scp 159command-line flag. 160For full details of the options listed below, and their possible values, see 161.Xr ssh_config 5 . 162.Pp 163.Bl -tag -width Ds -offset indent -compact 164.It AddressFamily 165.It BatchMode 166.It BindAddress 167.It BindInterface 168.It CanonicalDomains 169.It CanonicalizeFallbackLocal 170.It CanonicalizeHostname 171.It CanonicalizeMaxDots 172.It CanonicalizePermittedCNAMEs 173.It CASignatureAlgorithms 174.It CertificateFile 175.It CheckHostIP 176.It Ciphers 177.It Compression 178.It ConnectionAttempts 179.It ConnectTimeout 180.It ControlMaster 181.It ControlPath 182.It ControlPersist 183.It GlobalKnownHostsFile 184.It GSSAPIAuthentication 185.It GSSAPIDelegateCredentials 186.It HashKnownHosts 187.It Host 188.It HostbasedAcceptedAlgorithms 189.It HostbasedAuthentication 190.It HostKeyAlgorithms 191.It HostKeyAlias 192.It Hostname 193.It IdentitiesOnly 194.It IdentityAgent 195.It IdentityFile 196.It IPQoS 197.It KbdInteractiveAuthentication 198.It KbdInteractiveDevices 199.It KexAlgorithms 200.It KnownHostsCommand 201.It LogLevel 202.It MACs 203.It NoHostAuthenticationForLocalhost 204.It NumberOfPasswordPrompts 205.It PasswordAuthentication 206.It PKCS11Provider 207.It Port 208.It PreferredAuthentications 209.It ProxyCommand 210.It ProxyJump 211.It PubkeyAcceptedAlgorithms 212.It PubkeyAuthentication 213.It RekeyLimit 214.It SendEnv 215.It ServerAliveInterval 216.It ServerAliveCountMax 217.It SetEnv 218.It StrictHostKeyChecking 219.It TCPKeepAlive 220.It UpdateHostKeys 221.It User 222.It UserKnownHostsFile 223.It VerifyHostKeyDNS 224.El 225.It Fl P Ar port 226Specifies the port to connect to on the remote host. 227Note that this option is written with a capital 228.Sq P , 229because 230.Fl p 231is already reserved for preserving the times and mode bits of the file. 232.It Fl p 233Preserves modification times, access times, and file mode bits from the 234source file. 235.It Fl q 236Quiet mode: disables the progress meter as well as warning and diagnostic 237messages from 238.Xr ssh 1 . 239.It Fl R 240Copies between two remote hosts are performed by connecting to the origin 241host and executing 242.Nm 243there. 244This requires that 245.Nm 246running on the origin host can authenticate to the destination host without 247requiring a password. 248.It Fl r 249Recursively copy entire directories. 250Note that 251.Nm 252follows symbolic links encountered in the tree traversal. 253.It Fl S Ar program 254Name of 255.Ar program 256to use for the encrypted connection. 257The program must understand 258.Xr ssh 1 259options. 260.It Fl s 261Use the SFTP protocol for transfers rather than the original scp protocol. 262.It Fl T 263Disable strict filename checking. 264By default when copying files from a remote host to a local directory 265.Nm 266checks that the received filenames match those requested on the command-line 267to prevent the remote end from sending unexpected or unwanted files. 268Because of differences in how various operating systems and shells interpret 269filename wildcards, these checks may cause wanted files to be rejected. 270This option disables these checks at the expense of fully trusting that 271the server will not send unexpected filenames. 272.It Fl v 273Verbose mode. 274Causes 275.Nm 276and 277.Xr ssh 1 278to print debugging messages about their progress. 279This is helpful in 280debugging connection, authentication, and configuration problems. 281.El 282.Sh EXIT STATUS 283.Ex -std scp 284.Sh SEE ALSO 285.Xr sftp 1 , 286.Xr ssh 1 , 287.Xr ssh-add 1 , 288.Xr ssh-agent 1 , 289.Xr ssh-keygen 1 , 290.Xr ssh_config 5 , 291.Xr sftp-server 8 , 292.Xr sshd 8 293.Sh HISTORY 294.Nm 295is based on the rcp program in 296.Bx 297source code from the Regents of the University of California. 298.Sh AUTHORS 299.An Timo Rinne Aq Mt tri@iki.fi 300.An Tatu Ylonen Aq Mt ylo@cs.hut.fi 301.Sh CAVEATS 302The original SCP protocol (used by default) requires execution of the 303remote user's shell to perform 304.Xr glob 3 305pattern matching. 306This requires careful quoting of any characters that have special meaning to 307the remote shell, such as quote characters. 308