Scp

From OnnoWiki
Revision as of 16:07, 4 October 2017 by Onnowpurbo (talk | contribs)
Jump to navigation Jump to search

Secure Copy atau SCP berarti mentransfer file komputer antara lokal dari host remote atau antara dua host remote. Ini berbasis pada protokol Secure Shell (SSH).

Istilah SCP mengacu pada dua hal, protokol SCP atau program SCP.


SCP protocol

Protokol SCP adalah protokol jaringan, berdasarkan protokol BSD RCP, yang mendukung transfer file antar host pada jaringan. SCP menggunakan Secure Shell (SSH) untuk transfer data dan menggunakan mekanisme otentikasi yang sama, sehingga memastikan keaslian dan kerahasiaan data dalam perjalanan. Klien dapat mengirim (upload) file ke server, termasuk atribut dasar (perizinan, cap waktu). Klien juga bisa meminta file atau direktori dari server (download). SCP berjalan di atas port TCP 22 secara default. Seperti RCP, tidak ada RFC yang mendefinisikan spesifik protokol.

Cara Kerja

Biasanya, klien memulai koneksi SSH ke host jarak jauh, dan meminta proses SCP dimulai di server jauh. Proses SCP remote dapat beroperasi dalam salah satu dari dua mode: mode sumber, yang membaca file (biasanya dari disk) dan mengirimnya kembali ke klien, atau mode wastafel, yang menerima file yang dikirim oleh klien dan menuliskannya (biasanya ke disk ) pada remote host. Untuk kebanyakan klien SCP, mode sumber umumnya dipicu oleh flag -f (dari), sementara mode wastafel dipicu dengan -t (to). Flag ini digunakan secara internal dan tidak didokumentasikan di luar source code scp.

Remote to remote mode

In remote-to-remote secure copy, the SCP client opens an SSH connection to the source host and requests that it, in turn, open an SCP connection to the destination. (Remote-to-remote mode does not operate by opening two SCP connections and using the originating client as an intermediary). It is important to note that SCP cannot 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 is, however, possible with key-based or GSSAPI methods that do not require user input.

SCP program

The SCP program is a software tool implementing the SCP protocol as a service daemon or client. It is a program to perform secure copying. The SCP server program is typically the same program as the SCP client.

Perhaps the most widely used SCP program is the command line scp program, which is provided in most SSH implementations. The scp program is the secure analog of the rcp command. The scp program must be part of all SSH servers that want to provide SCP service, as scp functions as SCP server too.

Some SSH implementations provide the scp2 program, which uses the SFTP protocol instead of SCP, but provides the very same command line interface as scp. scp is then typically a symbolic link to scp2.

Typically, a syntax of scp program is like the syntax of cp:

Copying file to host:

scp SourceFile user@host:directory/TargetFile

Copying file from host:

scp user@host:directory/SourceFile TargetFile
scp -r user@host:directory/SourceFile TargetFolder

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

scp -P 2222 user@host:directory/SourceFile TargetFile

As the SCP 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. 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 the ls command). This in turn brings platform-dependency problems. Thus it may not be possible to work with a particular SCP server using a GUI SCP client, even if you are able to work with the same server using a traditional command line client.

More comprehensive tools for managing files over SSH are SFTP clients.

Pranala Menarik