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

SecureCRT 使用 rz/sz 實現 Linux 與 Windows 文件高速傳輸

編輯:Linux 教學

rz/sz 是 ZModem 協議在 Linux 下的實現,配合 SecureCRT 可實現圖形化文件上傳下載,比 scp 更直觀。本文記錄 CentOS 安裝 lrzsz、解決 yum 鎖衝突、SecureCRT 設置全流程。

一、 安裝 lrzsz 包

# 檢查是否已安裝
rpm -qa | grep lrzsz

# 安裝
sudo yum install lrzsz

二、 解決 yum 鎖衝突(常見於虛擬機)

報錯:Existing lock /var/run/yum.pid: another copy is running as pid 3604...

原因:yum-updatesd 後台服務佔用鎖。解決:

sudo /sbin/service yum-updatesd stop
# 或永久禁用
sudo chkconfig yum-updatesd off

停止服務後重新執行 yum install lrzsz 即可成功。

三、 SecureCRT 設置 ZModem 上傳下載目錄

  1. 打開 Options → Session Options。
  2. 展開 Terminal → Xmodem/Zmodem。
  3. 設置 Download Directory(下載保存路徑)和 Upload Directory(上傳默認路徑)。
  4. 勾選 Auto-start Zmodem upload,點擊 OK 保存。

四、 實戰操作

上傳文件(Windows → Linux)

# 在 Linux 終端執行
rz

彈出文件選擇框,選中文件(支持多選)點擊「打開」,文件自動上傳到當前目錄。
記憶口訣:rz = Receive Zmodem(服務端視角「接收」)。

下載文件(Linux → Windows)

# 單文件
sz filename

# 多文件
sz file1 file2 dir/*

文件自動下載到 SecureCRT 設置的 Download Directory。

五、 常見問題與技巧

  • 亂碼/傳輸中斷:確保終端編碼與 SecureCRT 一致(推薦 UTF-8)。
  • 大文件傳輸:ZModem 支持斷點續傳,網絡抖動自動重試。
  • 批量操作:sz *.log 配合通配符高效下載日志。
  • 替代方案:生產環境推薦 scp/rsync/sftp,支持腳本自動化與帶寬限制。

六、 核心命令速查

命令方向說明
rz上傳彈出框選文件上傳到當前目錄
sz file下載將指定文件下載到本地設置目錄
sz -bey file下載二進制模式、強制覆蓋、保留路徑
Copyright © Windows教程網 All Rights Reserved