Linux/기타

scp 사용하기

HoyoungEE 2015. 6. 16. 14:31

==================================================================== OPENSSH-LAB> scp 사용하기

!!!! 반드시 호스트명 or IP 주소 뒤에 :(콜론)을 붙여야 한다. !!!!

+--------+ +--------+ | | | | | Client | ---> | Server | | | | | +--------+ +--------+ root ---> user : sshuser port : 22 Upload -----> <----- Download **** scp 는 포트번호가 22번이 아니면 -P(대문자) 옵션을 사용한다. **** **** 보안상 서버가 포트번호 22 를 다른 포트 (2200) 로 변경할때는 **** alias 를 이용하면 편리하게 접속할 수 있다. **** # alias scp='scp -P2200' usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port] [-S program] [[user@]host1:]file1 ... [[user@]host2:]file2 조건1 : /etc/passwd Upload : C ---> S Dowonload : C <--- S - Upload (/etc/passwd 파일을 sshuser@localhost로 복사) # scp /etc/passwd sshuser@localhost: - Dowonload (sshuser@localhost:passwd 파일을 /tmp 로 복사) # scp sshuser@localhost:passwd /tmp - Upload (/etc 디렉토리를 sshuser@localhost 몽땅 복사) - -r 옵션은 디렉토리를 복사할때 사용한다. # scp -r /etc sshuser@localhost: - Dowonload (sshuser@localhost:etc 디렉토리를 몽땅 /tmp로 복사) - -r 옵션은 디렉토리를 복사할때 사용한다. # scp -r sshuser@localhost:etc /tmp ====================================================================