Perintah scp adalah adalah utilitas di sistem operasi berbasis Unix yang digunakan untuk menyalin file dan direktori antara komputer secara aman melalui protokol SSH (Secure Shell). Perintah scp menggabungkan fungsi salin file dengan keamanan dari SSH, sehingga data yang ditransfer dienkripsi selama pengiriman.
Menyalin file dari lokal ke remote:
[code lang=”bash”]
scp /path/to/local/file username@remote_host:/path/to/remote/destination/directory/
[/code]
Menyalin file dari remote ke lokal
[code lang=”bash”]
scp username@remote_host:/path/to/remote/file /path/to/local/destination/directory/
[/code]
Menyalin direktori secara rekursif dari lokal ke remote
[code lang=”bash”]
scp -r /path/to/local/directory username@remote_host:/path/to/remote/destination/directory/
[/code]
Menyalin direktori secara rekursif dari remote ke lokal
[code lang=”bash”]
scp -r username@remote_host:/path/to/remote/directory /path/to/local/destination/directory/
[/code]
Opsi Tambahan pada Perintah scp
-P port: Menentukan port yang akan digunakan (defaultnya adalah port 22 untuk SSH)
[code lang=”bash”]
scp -P 2222 /path/to/local/file username@remote_host:/path/to/remote/destination/directory/
[/code]
-i identity_file: Menentukan file kunci identitas (private key) yang akan digunakan untuk autentikasi.
[code lang=”bash”]
scp -i /path/to/private_key /path/to/local/file username@remote_host:/path/to/remote/destination/directory/
[/code]
-v: Mode verbose, menampilkan informasi lebih rinci tentang proses transfer, berguna untuk debugging.
[code lang=”bash”]
scp -v /path/to/local/file username@remote_host:/path/to/remote/destination/directory/
[/code]
-C: Mengaktifkan kompresi selama transfer untuk mengurangi ukuran data yang dikirim.
[code lang=”bash”]
scp -C /path/to/local/file username@remote_host:/path/to/remote/destination/directory/
[/code]
Leave a Reply