Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

14.4.2. scp ユーティリティーの使用

scp を使用すると、暗号化されたセキュアな接続でマシン間でファイルを転送できます。設計に関しては、rcp と非常に似ています。
ローカルファイルをリモートシステムへ転送するには、以下の形式でコマンドを使用します。
scp localfile username@hostname:remotefile
たとえば、taglist.vimpenguin.example.com という名前のリモートマシンに転送する場合は、シェルプロンプトで以下を入力します。
~]$ scp taglist.vim john@penguin.example.com:.vim/plugin/taglist.vim
john@penguin.example.com's password:
taglist.vim                                   100%  144KB 144.5KB/s   00:00
一度に複数のファイルを指定することも可能です。.vim/plugin/ の内容を、リモートマシン penguin.example.com の同じディレクトリーに転送するには、以下のコマンドを入力します。
~]$ scp .vim/plugin/* john@penguin.example.com:.vim/plugin/
john@penguin.example.com's password:
closetag.vim                                  100%   13KB  12.6KB/s   00:00    
snippetsEmu.vim                               100%   33KB  33.1KB/s   00:00    
taglist.vim                                   100%  144KB 144.5KB/s   00:00
リモートファイルをローカルシステムへ転送するには、以下の構文を使用します。
scp username@hostname:remotefile localfile
たとえば、.vimrc 設定ファイルをリモートマシンからダウンロードするには、以下を入力します。
~]$ scp john@penguin.example.com:.vimrc .vimrc
john@penguin.example.com's password:
.vimrc                                        100% 2233     2.2KB/s   00:00