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

Linux 與 Windows 檔案互傳實戰:架設 Serv-U FTP 服務與指令操作全攻略

編輯:Linux 教學

場景與方案選型

Linux 主機抓取圖片需插入 Windows Word、Windows 下載 Linux 套件需傳回安裝——雙向檔案傳輸剛需。方案採 FTP 協議,Windows 端部署 Serv-U 做 FTP Server,Linux 端用原生 ftp 指令客戶端,經測試穩定高效。

實驗環境

  • A 機 (Server):Windows 2000, IP 10.18.34.115
  • B 機 (Client):Red Hat 9.0, IP 10.18.34.251

Serv-U 安裝與精細配置

  1. 執行 setup.exe 全程預設安裝
  2. 配置精靈關鍵設定:
    • IP:10.18.34.115(動態 IP 可留空)
    • 域名:RoseRed(自訂)
    • 安裝為系統服務:Yes
    • 允許匿名登入:Yes(視需求)
    • 匿名主目錄:指定目錄並 鎖定 (Yes)
    • 建立具名帳號:Yes → 登入名 yint、密碼明文輸入、主目錄 E:\、鎖定主目錄、權限 No privilege
  3. 權限微調:左側選用戶 → 右側 Dir Access 標籤,勾選 Read、Write、List、Create 等目錄/檔案權限

完成後擁有 FTP Server RoseRed,兩帳號:Anonymous(無密碼)、yint(設定密碼)。

Linux 端 ftp 指令實戰速查

連線認證


ftp 10.18.34.115
# 輸入用戶名 yint 與密碼

下載檔案

指令語法範例說明
getget [remote] [local]get /rose/1.bmp 1.bmp單檔下載,遠端路徑用正斜線
mgetmget [remote-files]cd /rose; mget *.*批次下載,支援萬用字元,檔案存入當前本地目錄

上傳檔案

指令語法範例說明
putput [local] [remote]put 1.bmp /rose/333.bmp單檔上傳可改名,遠端路徑用正斜線
mputmput [local-files]cd /rose; mput *.bmp批次上傳,來源為本地當前目錄

關鍵路徑陷阱提醒

  • Linux 端啟動 ftp 時的當前工作目錄決定本地檔案存取基準
  • 遠端路徑以 FTP 根目錄為基準,Windows 路徑 E:\rose 對應 FTP 路徑 /rose
  • 大小寫敏感:Linux 區分大小寫,Windows 不區分,傳輸時注意檔名大小寫一致

進階技巧

  • binary / ascii 模式切換:二進位檔 (圖片、壓縮包、執行檔) 必須用 binary,文字檔可用 ascii 自動換行轉換
  • prompt 關閉互動確認:prompt off 配合 mget/mput 批次無人值守
  • 腳本化:ftp -n < script.txt 實現自動化備份/同步
  • 被動模式:防火牆/NAT 環境下啟用 passive

安全性補充

  • 生產環境禁用匿名寫入,帳號採強密碼
  • 考慮 SFTP (SSH File Transfer Protocol) 替代明文 FTP,OpenSSH 內建 sftp-server,Linux 端 sftp 指令用法近似
  • Windows 端可用 FileZilla Server (免費開源) 替代 Serv-U 獲得更好維護性
Copyright © Windows教程網 All Rights Reserved