Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> 關於 Linux

scp 跨伺服器安全複製實戰:參數全表、壓縮/限速/指定金鑰/批次模式、與 rsync 效能對比

編輯:關於 Linux

scp 基於 SSH 加密傳輸,適合中小檔案跨伺服器複製,不佔用大量 CPU/磁碟 I/O。

核心參數

  • -r:遞迴複製目錄。
  • -p:保留修改時間/權限/存取時間。
  • -C:啟用壓縮(慢速網路提速)。
  • -l limit:限制頻寬 Kbit/s。
  • -P port:指定 SSH 埠(大寫 P)。
  • -i keyfile:指定私鑰檔。
  • -B:批次模式(無互動提示)。
  • -v:除錯輸出。
  • -1/-2:強制 SSH 協定版本。

常用範例

  • 上傳目錄:scp -r /local/dir user@remote:/remote/path
  • 下載檔案:scp user@remote:/remote/file /local/path
  • 限速 10Mbps:scp -l 10000 largefile user@remote:/path
  • 指定金鑰:scp -i ~/.ssh/id_rsa_alt file user@remote:/path

scp vs rsync

單次中小檔傳輸首選 scp,同步備份、大量資料用 rsync。

上一頁123下一頁共3頁

Copyright © Windows教程網 All Rights Reserved
特性scprsync
加密內建 SSH需 -e ssh
增量無(全量)支援
大量小檔低 I/O 影響高 I/O 可能阻塞
斷點續傳無支援