Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Secure copy protocol

From Wikipedia, the free encyclopedia
Network protocol for copying files between computers
For the fictional organisation, seeSCP Foundation.
scp
DeveloperThe OpenSSH Project
Written inC
Operating systemCross-platform
TypeCommand,Communication protocol
Websitewww.openssh.com
Repositorygithub.com/openssh/openssh-portable/

Secure copy protocol (SCP) is a means of securely transferringcomputer files between a local host and a remotehost or between two remote hosts. It is based on theSecure Shell (SSH) protocol.[1] "SCP" commonly refers to both the Secure Copy Protocol and the program itself.[2]

According toOpenSSH developers in April 2019, SCP is outdated, inflexible and not readily fixed; they recommend the use of more modern protocols likeSFTP andrsync for file transfer.[3] As of OpenSSH version 9.0,scp client therefore uses SFTP for file transfers by default instead of the legacy SCP/RCP protocol.[4]

Secure Copy Protocol

[edit]

TheSCP is anetwork protocol, based on theBSDRCP protocol,[5] which supportsfile transfers between hosts on a network. SCP usesSecure Shell (SSH) for data transfer and uses the same mechanisms for authentication, thereby ensuring theauthenticity andconfidentiality of thedata in transit. A client can send (upload) files to a server, optionally including their basic attributes (permissions, timestamps). Clients can also request files or directories from a server (download). SCP runs overTCP port 22 by default.[6] Like RCP, there is noRFC that defines the specifics of the protocol.

Function

[edit]

Normally, a client initiates an SSH connection to the remote host, and requests an SCP process to be started on the remote server. The remote SCP process can operate in one of two modes:

  • source mode, which reads files (usually from disk) and sends them back to the client, or
  • sink mode, which accepts the files sent by the client and writes them (usually to disk) on the remote host.

For most SCP clients, source mode is generally triggered with the-f flag (from), while sink mode is triggered with-t (to).[2] These flags are used internally and are not documented outside the SCP source code.

Remote to remote mode

[edit]

In the past, in remote-to-remote secure copy, the SCP client would open an SSH connection to the source host and request that it, in turn, open an SCP connection to the destination. (Remote-to-remote mode did not support opening two SCP connections and using the originating client as an intermediary). SCP thus could not be used to remotely copy from the source to the destination when operating in password or keyboard-interactive authentication mode, as this would reveal the destination server's authentication credentials to the source. It was, however, possible with key-based orGSSAPI methods that do not require user input.[2]

More recently, remote-to-remote mode supports routing traffic through the client which originated the transfer, even though it is a 3rd party to the transfer. This way, authorization credentials must reside only on the originating client, the 3rd party.[7]

Issues using talkative shell profiles

[edit]

SCP does not expect text communicating with the SSH login shell. Text transmitted due to the SSH profile (e.g.echo "Welcome" in the.bashrc file) is interpreted as an error message, and a null line (echo "") causes SCP client to deadlock waiting for the error message to complete.[2]

scp program

[edit]

TheSCP program[8] is a software tool implementing the SCP protocol as a service daemon or client. It is a program to perform secure copying.

Perhaps the most widely used SCP program is the OpenSSHcommand linescp program, which is provided in most SSH implementations. Thescp program is the secure analog of thercp command. Thescp program must be part of all SSH servers that want to provide SCP service, asscp functions as SCP server too. Since OpenSSH 9.0, the program has been updated to use the newer, more secureSFTP protocol; an-O option is added for using SCP with old SCP-only servers.[4]

Syntax

[edit]

Typically, a syntax ofscp program[9] is like the syntax ofcp (copy):

Copying local file to a remote host:

scpLocalSourceFileuser@remotehost:directory/TargetFile

Copying file from remote host and recursively copying folder (with-r switch) from remote host:

scpuser@remotehost:directory/SourceFileLocalTargetFilescp -ruser@host:directory/SourceFolderLocalTargetFolder

Note that if the remote host uses a port other than the default of 22, it can be specified in the command. For example, copying a file from host:

scp -P 2222user@host:directory/SourceFileTargetFile

Other clients

[edit]

As theSecure Copy Protocol implements file transfers only,GUI SCP clients are rare, as implementing it requires additional functionality (directory listing at least). For example,WinSCP defaults to the SFTP protocol.[10] Even when operating in SCP mode, clients like WinSCP are typically not pure SCP clients, as they must use other means to implement the additional functionality (like thels command).[11] This in turn brings platform-dependency problems.

More comprehensive tools for managing files over SSH areSFTP clients.

Security

[edit]

In 2019 vulnerabilityCVE-2019-6111[12] was announced related to theopenssh SCP tool and protocol allowing users to overwrite arbitrary files in the SCP client target directory.

See also

[edit]
Wikibooks has a book on the topic of:Guide to Windows Commands

References

[edit]
  1. ^"Linux and Unix scp command".Computer Hope. Retrieved4 August 2015.
  2. ^abcdPechanec, Jan."How the SCP protocol works".Jan Pechanec's weblog. Oracle. Archived fromthe original on 2017-02-15. Retrieved4 August 2015.
  3. ^"OpenSSH 8.0".OpenSSH Release Notes. 17 April 2019.
  4. ^ab"OpenSSH 9.0".OpenSSH Release Notes. 8 April 2022.
  5. ^"scp(1) - OpenBSD manual pages (history section)". Retrieved25 June 2012.
  6. ^"SCP - Secure Copy Protocol - What is it & Full Definition & Example Cmds!".PC & Network Downloads - PCWDLD.com. 2019-06-29. Retrieved2020-05-22.
  7. ^Carroll, Brandon (16 August 2017)."How to use Secure Copy for file transfer".TechRepublic. Retrieved2020-05-22.
  8. ^"Portable OpenSSH".GitHub. 13 May 2022.
  9. ^"scp(1) - OpenBSD manual pages"https://man.openbsd.org/scp
  10. ^"Supported File Transfer Protocols :: WinSCP".winscp.net. Retrieved2020-05-22.
  11. ^"The SCP/Shell Page (Advanced Site Settings dialog) :: WinSCP".winscp.net. Retrieved2020-05-22.
  12. ^"NVD - Cve-2019-6111".
Ecosystem
Interpreters
Terminals
File system navigation
File management
Archiving
Disk management
Processes
Registry
User environment
File contents
Scripting
Networking
Maintenance and care
Boot management
Software development
Miscellaneous
Retrieved from "https://en.wikipedia.org/w/index.php?title=Secure_copy_protocol&oldid=1327265484"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp