반응형

/****************************************************************************************************************
-- Title : [Lnx] 리눅스 원격 파일 복사
-- Key word : scp rsync copy cp 복사
****************************************************************************************************************/

서버1(203.236.XXX.XXX) 과 서버2(203.236.YYY.YYY)postgres 계정일 경우 서로 간에 암호 없이

파일 및 폴더 복사가 가능.

 

복사 방법 예제

1)    서버1 /home/postgres/aaa.txt 를 서버2 /home/postgres 폴더 밑에 복사할 경우

- 서버 1 /home/postgres 폴더에서(~은 로그인의 홈디렉토리)

# scp r aaa.txt postgres@203.236.YYY.YYY:~/postgres/  

 

2)    서버2 /home/postgres/bbb/ 폴더를 서버1 /home/postgres 폴더 밑에 복사할 경우

- 서버 2 /home/porstgres 폴더에서

# scp r bbb postgres@203.236.XXX.XXX:~/postgres/        또는         # scp r /home/postgres/bbb postgres@203.236.XXX.XXX:~/postgres/

 

 

rsync 사용(암호 사용)

$ rsync -ra /databases/backup/cluster/* root@192.168.0.20:/databases/backup/cluster/

The authenticity of host '192.168.0.20 (192.168.0.21)' can't be established.

RSA key fingerprint is 53:1a:af:46:25:f4:2f:af:0d:28:50:2c:50:8f:34:e0.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '192.168.0.20' (RSA) to the list of known hosts.

root@192.168.0.20's password:

 

반응형

+ Recent posts