C.W.K.
Stream
Lesson 11 of 12 · published

SCP 기초

~15 min · scp, file-transfer, deprecated

Level 0Pinger
0 XP0/101 lessons0/12 achievements
0/150 XP to next level150 XP to go0% complete

SSH 위 가장 단순한 파일 복사

scpcp 처럼 생겼는데 출처 또는 목적지가 SSH 경유 원격 머신일 수 있어. 단일 파일이나 작은 디렉토리를 머신 사이에 옮기는 가장 단순한 방법. 같은 키, 같은 agent, 이미 세팅한 같은 SSH path — 새 자격증명, 새 도구 없음.

SCP 가 모자란 곳

SCP 는 일회성 파일 복사엔 좋아. 더 큰 일엔 안 맞아:

  • Delta transfer 없음 — 1 GB 파일에서 한 바이트 바뀌면 scp 가 전체 다시 복사.
  • Resume 없음 — 99% 에서 끊기면 처음부터.
  • Sync 없음 — 두 디렉토리 화해, 안 바뀐 거 건너뛰기 못 함.
  • 프로토콜 자체 deprecated — 모던 scp 명령은 사실 SFTP 아래서 씀.

빠른 파일 grab 너머는 rsync(Track 4). 인터랙티브 파일 브라우저는 sftp.

Code

흔한 scp 레시피·bash
# Local → remote
scp file.txt you_username@192.168.1.100:/home/you_username/

# Remote → local
scp you_username@192.168.1.100:/home/you_username/report.pdf ./

# Recursive — entire directory
scp -r ./project you_username@192.168.1.100:/home/you_username/

# Between two remote machines
scp you_username@server1:/file you_username@server2:/destination/

# Non-default port — note CAPITAL P (because scp is petty)
scp -P 2222 file.txt you_username@192.168.1.100:/home/you_username/

# Preserve modification times and permissions
scp -p file.txt you_username@host:/dest/

External links

Exercise

작은 파일 만들어 — echo "hello from $(hostname)" > /tmp/hello.txt. SSH 가능한 다른 머신으로 scp. SSH 들어가서 도착 확인. 다른 로컬 path 로 다시 scp. -r 로 작은 디렉토리도 시도. scp 가 ~/.ssh/config host alias (Track 3) 존중하는 거 확인 — alias 있으면 scp file.txt office:/tmp/ 동작.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.