Skip to content
Search

Secure copy

lastmod 2025-11-13created 2016-06-2114 edits

Secure copy, or SCP, is a means of securely transferring computer files between a local host and a remote host or between two remote hosts. It is based on the Secure Shell (SSH) protocol. The term SCP can refer to either the SCP protocol or the SCP program.

How to use

An SCP program is a software tool that implements the SCP protocol as a server daemon or client, a program that performs secure copying. The SCP server program is usually the same as the SCP client.

In general, the syntax of the scp program is similar to that of cp.

Copy a file to a host:

$ scp 원본파일 사용자@호스트주소:디렉터리/대상파일

Copy a file from a host:

$ scp 사용자@호스트주소:디렉터리/원본파일 대상파일
$ scp -r 사용자@호스트주소:디렉터리/원본폴더 대상폴더

WARNING

When writing the remote address, you must include the :.

Remote -> remote also works:

$ scp [유저명]@[IP주소]:[전송할 파일 경로] [유저명]@[IP주소]:[받을 경로]

Flags

  • -r - Recursive, which copies everything including subfolders
  • -P - Specify the ssh port
  • -p - Preserve, which keeps permissions and attributes
  • -c - Compress, which performs compression; these are some of the options.
  • -v - Used when debugging while viewing details (verbose mode)
  • -i - Use a specified identity file (specify the identity file path)

Example

How to download from an SCP remote to local:

scp -P 8888 [email protected]:/home/yourname/Downloads/backup.sql backup.sql

How to send a local file to a remote

scp install.sh [email protected]:/home/aaa/Downloads/

See also

Favorite site

author Zer0 sitemap