SCP(1)
π SCP(1) β OpenSSH secure file copy π
(straight outta the General Commands Manual, bestie)
β¨ NAME β¨
scp β OpenSSH secure file copy π«Ά like, the file-copying-est tool that ever copied files over a network
π SYNOPSIS π
scp [-346ABCOpqRrsTvZ] [-c cipher] [-D sftp_server_path] [-F ssh_config]
[-i identity_file] [-J destination] [-l limit] [-o ssh_option]
[-P port] [-S program] [-X sftp_option] source ... target
πΈ DESCRIPTION πΈ
okay so, scp copies files between hosts on a network. it's binary compatible with OpenSSH's scp, and it uses the same directives and configuration options too β except where noted. no cap.
scp uses the SFTP protocol over an ssh(1) connection to move your data around, and it uses the same authentication and gives you the same security as a login session. it's giving "safe" and it's giving "iconic".
scp will ask for passwords or passphrases if they're needed for authentication. like it will literally just ask, no shame.
Your source and target can be any of these three vibes:
- a local pathname
- a remote host with an optional path, in the form
[user@]host:[path] - a URI in the form
scp://[user@]host[:port][/path]
Local file names can be made explicit using absolute or relative pathnames, so you can avoid scp treating file names containing : as host specifiers. π© because yes, that colon is a trap if you're not careful.
When copying between two remote hosts, if you're using the URI format, you cannot specify a port on the target if the -R option is used. noted. periodt.
The options are as follows:
π OPTIONS π
-3β Copies between two remote hosts are transferred through the local host. This mode is the default, but see also the-Roption for copying data directly between two remote hosts. heads up though: when using the legacy SCP protocol (via the-Oflag), this option selects batch mode for the second host, becausescpcannot ask for passwords or passphrases for both hosts. it simply can't. π-4β Forcesscpto use IPv4 addresses only.-6β Forcesscpto use IPv6 addresses only.-Aβ Allows forwarding ofssh-agent(1)to the remote system. The default is not to forward an authentication agent. π-Bβ Selects batch mode (prevents asking for passwords or passphrases). quiet, mysterious, no small talk.-Cβ Compression enable. Passes the-Cflag tossh(1)to enable compression. smaller files, faster vibes β¨-ccipher β Selects the cipher to use for encrypting the data transfer. This option is directly passed tossh(1).-Dsftp_server_path β Connect directly to a local SFTP server program rather than a remote one viassh(1). This option may be useful in debugging the client and server. π§-Fssh_config β Specifies an alternative per-user configuration file forssh. This option is directly passed tossh(1).-iidentity_file β Selects the file from which the identity (private key) for public key authentication is read. This option is directly passed tossh(1). ποΈ-Jdestination β Connect to the target host by first making anscpconnection to the jump host described by destination, and then establishing a TCP forwarding to the ultimate destination from there. Multiple jump hops may be specified separated by comma characters. This is a shortcut to specify aProxyJumpconfiguration directive. This option is directly passed tossh(1). π¦ hop hop hop-llimit β Limits the used bandwidth, specified in Kbit/s.-Oβ Use the legacy SCP protocol for file transfers instead of the SFTP protocol. Forcing the use of the SCP protocol may be necessary for servers that do not implement SFTP, for backwards-compatibility for particular filename wildcard patterns, and for expanding paths with a~prefix for older SFTP servers.-ossh_option β Can be used to pass options tosshin the format used inssh_config(5). This is useful for specifying options for which there is no separatescpcommand-line flag. For full details of the options listed below, and their possible values, seessh_config(5).AddKeysToAgentAddressFamilyBatchModeBindAddressBindInterfaceCASignatureAlgorithmsCanonicalDomainsCanonicalizeFallbackLocalCanonicalizeHostnameCanonicalizeMaxDotsCanonicalizePermittedCNAMEsCertificateFileChannelTimeoutCheckHostIPCiphersClearAllForwardingsCompressionConnectTimeoutConnectionAttemptsControlMasterControlPathControlPersistDynamicForwardEnableEscapeCommandlineEnableSSHKeysignEscapeCharExitOnForwardFailureFingerprintHashForkAfterAuthenticationForwardAgentForwardX11ForwardX11TimeoutForwardX11TrustedGSSAPIAuthenticationGSSAPIDelegateCredentialsGatewayPortsGlobalKnownHostsFileHashKnownHostsHostHostKeyAlgorithmsHostKeyAliasHostbasedAcceptedAlgorithmsHostbasedAuthenticationHostnameIPQoSIdentitiesOnlyIdentityAgentIdentityFileIgnoreUnknownIncludeKbdInteractiveAuthenticationKbdInteractiveDevicesKexAlgorithmsKnownHostsCommandLocalCommandLocalForwardLogLevelLogVerboseMACsNoHostAuthenticationForLocalhostNumberOfPasswordPromptsObscureKeystrokeTimingPKCS11ProviderPasswordAuthenticationPermitLocalCommandPermitRemoteOpenPortPreferredAuthenticationsProxyCommandProxyJumpProxyUseFdpassPubkeyAcceptedAlgorithmsPubkeyAuthenticationRekeyLimitRemoteCommandRemoteForwardRequestTTYRequiredRSASizeRevokedHostKeysSecurityKeyProviderSendEnvServerAliveCountMaxServerAliveIntervalSessionTypeSetEnvStdinNullStreamLocalBindMaskStreamLocalBindUnlinkStrictHostKeyCheckingSyslogFacilityTCPKeepAliveTagTunnelTunnelDeviceUpdateHostKeysUseMPTCPUserUserKnownHostsFileVerifyHostKeyDNSVisualHostKeyXAuthLocation
-Pport β Specifies the port to connect to on the remote host. Note that this option is written with a capitalP, because-pis already reserved for preserving the times and mode bits of the file. yes bestie, case matters. it always matters. π-pβ Preserves modification times, access times, and file mode bits from the source file. πΎ keeping the receipts-qβ Quiet mode: disables the progress meter as well as warning and diagnostic messages fromssh(1). shhh π€«-Rβ Copies between two remote hosts are transferred through the local host by default. This option instead copies between two remote hosts by connecting to the origin host and executingscpthere. This requires thatscprunning on the origin host can authenticate to the destination host without requiring a password. π-rβ Recursively copy entire directories. Note thatscpfollows symbolic links encountered in the tree traversal. π³-Zβ Resume failed or interrupted transfer. Identical files will be skipped. Remote must haveresumeoption.scponly option.-Sprogram β Name of program to use for the encrypted connection. The program must understandssh(1)options.-zprogram β Path tohpnscpon remote system. Useful if remote has multiplescpinstalls. For example, using the resume option but the default remotescpdoes not have the resume option. Use-zto point the version that does β e.g.-z /opt/hpnssh/bin/hpnscp.scponly option.-sβ Use the SFTP protocol for transfers rather than the originalscpprotocol.-Tβ Disable strict filename checking. By default, when copying files from a remote host to a local directory,scpchecks that the received filenames match those requested on the command-line, to prevent the remote end from sending unexpected or unwanted files. Because of differences in how various operating systems and shells interpret filename wildcards, these checks may cause wanted files to be rejected. This option disables these checks at the expense of fully trusting that the server will not send unexpected filenames. π so like, trust fall, but with your filesystem-vβ Verbose mode. Causesscpandssh(1)to print debugging messages about their progress. This is helpful in debugging connection, authentication, and configuration problems. π the detective era-Xsftp_option β Specify an option that controls aspects of SFTP protocol behaviour. The valid options are:nrequests=valueβ Controls how many concurrent SFTP read or write requests may be in progress at any point in time during a download or upload. This value must be between 1 and 8192. By default 1024 requests may be active concurrently.buffer=valueβ Controls the maximum buffer size for a single SFTP read/write operation used during download or upload. This value must be between 1B and 255KB. You may use theKunit for the size. E.g.32768or32K. By default a 32KB buffer is used.
β οΈ bestie listen. Usage of SCP protocol can be blocked by creating a world-readable/etc/ssh/disable_scpfile. If this file exists, when SCP protocol is in use (either remotely or via the-Ooption), the program will exit. no negotiation, no vibe check, it's just gone. π
π EXIT STATUS π
The scp utility exits 0 on success, and >0 if an error occurs.
(...to be continued, bestie β part 2 is coming π)
β¨ SEE ALSO β¨
ok so if you wanna go deeper (and bestie, you should), go peek at these:
the whole little ssh family, all in one friend group π
πΈ HISTORY πΈ
so scp didn't just appear out of nowhere β it's based on the rcp program in BSD source code from the Regents of the University of California. like, it has ancestry. main character with a whole lineage fr π
and the glow-up: since OpenSSH 9.0, scp has used the SFTP protocol for transfers by default. no cap, that's just how it rolls now β¨
π«Ά AUTHORS π«Ά
the icons who made this happen:
- Timo Rinne
<tri@iki.fi> - Tatu Ylonen
<ylo@cs.hut.fi> - Chris Rapier
<rapier@psc.edu>
give them their flowers, they earned them π
π CAVEATS π
listen up, this one's important, don't skip it bestie π
The legacy SCP protocol β the one you get when you pick the -O flag β requires execution of the remote user's shell to perform glob(3) pattern matching.
and because of that, you have to be careful. like, careful careful. It requires careful quoting of any characters that have special meaning to the remote shell, such as quote characters.
so yeah, quote your stuff properly or the remote shell will interpret things you did not mean for it to interpret. it's giving chaos if you don't. π
and that's the whole page, bestie!! you made it all the way through, iconic behavior honestly π β¨
this was the SCP(1) page from the Debian build, dated October 4, 2025 β go forth and copy files responsibly, mwah ππ¦
π¦ where this page comes from
- fedora 44: gsi-openssh-clients 10.2p1-1.fc44 Β· BSD-3-Clause AND BSD-2-Clause AND ISC AND SSH-OpenSSH AND ssh-keyscan AND sprintf AND LicenseRef-Fedora-Public-Domain AND X11-distribute-modifications-variant
- fedora 44: gsi-openssh-clients 10.2p1-4.fc44 Β· BSD-3-Clause AND BSD-2-Clause AND ISC AND SSH-OpenSSH AND ssh-keyscan AND snprintf AND LicenseRef-Fedora-Public-Domain AND X11-distribute-modifications-variant
- Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms