macOS, Linux によるファイル転送方法(scpコマンド)
最終更新日:2019年1月17日scpコマンド
利用方法
$ scp -i [秘密鍵ファイルのパス] [コピー元パス] [コピー先パス] Enter passphrase for key '/home/clientuser/.ssh/ito_id_rsa': ←パスフレーズ(鍵生成の際に設定したもの)を入力(表示されません) |
実行例
(パターン1)ローカルにある"local.txt"を"/home/usr5/abc1234/work/"配下へ送信する。
※秘密鍵は"ホーム領域の".ssh/ito_id_rsa"にある場合の例である。
$ scp -i ~/.ssh/ito_id_rsa ./local.txt abc1234@ito.cc.kyushu-u.ac.jp:/home/usr5/abc1234/work/ |
リモートの"remote.txt"を現在のディレクトリ"./"に受信する。
※秘密鍵は"ホーム領域の".ssh/ito_id_rsa"にある場合の例である。
$ scp -i ~/.ssh/ito_id_rsa abc1234@ito.cc.kyushu-u.ac.jp:/home/usr5/abc1234/remote.txt ./ |