<p><span style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;">local 서버에서 remote 서버에 파일을 올리고 받을 때는 주로 FTP를 사용하지만, 시스템을 설정하고 테스트하고 잦은 파일 교환 작업을 할 때는 GUI툴을 사용하지 않고 local에서 파일을 복사하듯이 사용해야 할 때가 있다. SSH를 통해서 scp 명령으로 안전하고 간단하게 파일을 복사할수 있다.&nbsp;</span><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><font color="#57048c" style="font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;"></font></p>
<div class="txc-textbox" style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; border-style: solid; border-width: 1px; border-color: #c1c1c1; background-color: #eeeeee; padding: 10px;">
   <p><font color="#57048c">$ scp&nbsp;</font><font color="#3058d2">&lt;옵션&gt;</font><font color="#57048c">&nbsp;&lt;원본 경로 및 파일&gt; &lt;복사 받을 곳 경로 및 파일&gt;</font></p>
   </div>
<p><font color="#57048c" style="font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;"><br />명령어</font><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><font color="#3058d2" style="font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;">옵션</font><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><font color="#e31600" style="font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;">Remote 서버 경로</font><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><span style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;">local 서버 경로</span><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><b style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;">1.</b><span style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;">&nbsp;Remote 서버에 파일&nbsp;</span><b style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;">올리기</b><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><font color="#57048c" style="font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;"></font></p>
<div class="txc-textbox" style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; border-style: solid; border-width: 1px; border-color: #c1c1c1; background-color: #eeeeee; padding: 10px;">
   <p><font color="#57048c">$</font><b style="color: #57048c;">&nbsp;scp</b><font color="#0686a8">&nbsp;-P 22</font><font color="#57048c">&nbsp;</font><font color="#2b8400">/home/myhome/abc.tar</font><font color="#57048c">&nbsp;</font><font color="#e31600">oracle@123.456.78.9:/home/oracle/</font></p>
   </div>
<p><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><span style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;">abc.tar 파일을 123.456.78.9 서버의 22번 포트로 SSH 접속하여 oracle 사용자로 로그인 한 후 /home/oracle/ 아래에 복사한다.</span><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><b style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;">2.&nbsp;</b><span style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;">Remote 서버에서 파일</span><b style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;">&nbsp;받기</b><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><font color="#57048c" style="font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;"></font></p>
<div class="txc-textbox" style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; border-style: solid; border-width: 1px; border-color: #c1c1c1; background-color: #eeeeee; padding: 10px;">
   <p><font color="#57048c">$&nbsp;<b>scp</b>&nbsp;</font><font color="#0686a8">-P 22</font><font color="#57048c">&nbsp;</font><font color="#e31600">root@123.456.78.9:/usr/local/abc.xml</font><font color="#2b8400">&nbsp;/home/oracle/</font></p>
   </div>
<p><font color="#2b8400" style="font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;"></font><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><span style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;">remote 서버의 abc.xml 파일을 local의 /home/oracle로 다운로드 받는다.</span><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><span style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;">SSH포트는 변경하는 경우가 많으므로 -P 옵션 사용했고, 서버 주소와 디렉토리의 구분은 콜론(:)을 사용한다. 원격지의 home 주소는 "./"를 사용해도 된다.</span><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><span style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;">Ex) root@123.456.78.9:./</span><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /></p>
<div class="txc-textbox" style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; border-style: dashed; border-width: 1px; border-color: #fe8943; background-color: #fedec7; padding: 10px;">
   <p>자주사용하는 옵션<br />-P : 포트번호 지정<br />-p : preserve의 약자로 원본 파일 시간의 수정시간, 사용시간, 권한을 유지한다.<br />-r : recursive의 약자로 하위 폴더/파일 모두 복사한다.</p>
   </div>
<p><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><br style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" /><span style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;">출처:&nbsp;</span><a href="https://dinggur.tistory.com/94" style="color: #666666; text-decoration-line: none; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;" target="_blank">https://dinggur.tistory.com/94</a><span style="color: #666666; font-family: Dotum, Verdana, AppleGothic, sans-serif; background-color: #969696;">&nbsp;[아무도없는세계]</span></p>