File Sharing Protocols Overview

Level: Intermediate Module: File Sharing & Print 10 min read Lesson 34 of 66

Overview

  • What you’ll learn: The major file sharing protocols used in Linux environments — NFS, SMB/CIFS, and FTP — including their architectures, strengths, limitations, and the network ports they require.
  • Prerequisites: Basic Linux command-line skills, understanding of TCP/IP networking fundamentals
  • Estimated reading time: 15 minutes

Introduction

File sharing is one of the most fundamental services provided by networked servers. Whether you are distributing configuration files to a fleet of Linux machines, providing shared storage to Windows desktops in an office, or allowing remote users to upload content, you need a protocol that matches your requirements for performance, security, and compatibility.

Linux supports several file sharing protocols natively, each designed for different scenarios. Network File System (NFS) is the traditional choice for Unix-to-Unix sharing, Server Message Block (SMB/CIFS) enables interoperability with Windows clients, and File Transfer Protocol (FTP) provides a simple mechanism for transferring files over the network. Understanding when and why to use each protocol is essential before diving into their individual configurations.

In this lesson, we will examine the architecture of each protocol, compare their features side by side, review the network ports they use, and discuss real-world use cases to help you choose the right protocol for any given scenario.

NFS — Network File System

NFS was developed by Sun Microsystems in the 1980s and has become the standard file sharing protocol in Unix and Linux environments. The current production version is NFSv4, which introduced significant improvements over NFSv3 including stateful operation, integrated security through Kerberos, and a single TCP port for firewall-friendly deployments.

NFS operates on a client-server model. The server exports directories by listing them in its configuration, and clients mount those exported directories as if they were local file systems. This transparency is one of NFS’s greatest strengths — applications on the client do not need to know they are accessing remote files.

# NFS uses the following ports:
# NFSv3: portmapper (111/tcp,udp), nfsd (2049/tcp,udp),
#         mountd (dynamic), statd (dynamic), lockd (dynamic)
# NFSv4: nfsd (2049/tcp) — single port only

# Check NFS server status
$ rpcinfo -p localhost
   program vers proto   port  service
    100000    4   tcp    111  portmapper
    100003    4   tcp   2049  nfs
    100005    3   tcp  20048  mountd

# View exports from a server
$ showmount -e 192.168.1.10
Export list for 192.168.1.10:
/srv/shared  192.168.1.0/24
/srv/home    *.example.com

NFS is best suited for homogeneous Linux/Unix environments where you need transparent file system access with POSIX permission support. Typical use cases include shared home directories across multiple servers, centralized application data, and NFS-backed storage for containers and virtual machines.

NFS Versions Compared

  • NFSv3: Stateless protocol, uses multiple ports (requires RPC portmapper), supports UDP and TCP, relies on external locking via NLM (Network Lock Manager). Still widely used but harder to firewall.
  • NFSv4: Stateful protocol, single port (2049/tcp), built-in locking and delegation, mandatory security with Kerberos support (via RPCSEC_GSS), compound operations for better performance over WAN. Recommended for all new deployments.
  • NFSv4.1/4.2: Adds parallel NFS (pNFS) for clustered storage, server-side copy, sparse file support, and improved session management.

SMB/CIFS — Server Message Block

SMB is the native file sharing protocol of the Windows ecosystem. Originally developed by IBM and later extended by Microsoft, it is now an open standard. On Linux, the Samba project provides both server and client implementations of the SMB protocol, enabling seamless file sharing between Linux and Windows systems.

SMB is a more complex protocol than NFS because it was designed for environments that include user-level authentication, access control lists (ACLs), printer sharing, and service discovery. Modern SMB versions (SMB2 and SMB3) offer significant performance improvements, encryption, and multi-channel support.

# SMB uses the following ports:
# NetBIOS Name Service:   137/udp
# NetBIOS Datagram:       138/udp
# NetBIOS Session / SMB:  139/tcp
# SMB over TCP (Direct):  445/tcp
# SMB2/SMB3 use port 445/tcp exclusively

# Test connectivity to an SMB server
$ smbclient -L //192.168.1.10 -U guest
Sharename       Type      Comment
---------       ----      -------
shared          Disk      Public Files
printers        Printer   All Printers
IPC$            IPC       IPC Service

# Mount an SMB share on Linux
$ sudo mount -t cifs //192.168.1.10/shared /mnt/shared 
    -o username=admin,password=secret,vers=3.0

SMB is the right choice when your environment includes Windows clients, when you need integrated printer sharing, or when you need Active Directory-based authentication. Samba on Linux can even serve as a full Active Directory domain controller.

SMB Versions

  • SMB1/CIFS: Legacy protocol, significant security vulnerabilities (WannaCry exploited SMBv1). Should be disabled on all systems.
  • SMB2: Introduced with Windows Vista/2008. Reduced protocol chattiness, larger reads/writes, improved caching.
  • SMB3: Introduced with Windows 8/2012. Adds encryption, multi-channel, transparent failover, and RDMA support. Recommended for all deployments.

FTP — File Transfer Protocol

FTP is one of the oldest Internet protocols, dating back to 1971. It provides a straightforward mechanism for uploading and downloading files. Unlike NFS and SMB, FTP does not provide transparent file system access — clients explicitly connect, browse, and transfer files using dedicated FTP commands.

FTP operates using two channels: a control channel (port 21) for commands and a data channel for actual file transfers. The data channel can operate in active mode (server connects back to client) or passive mode (client connects to server), which has significant implications for firewall configuration.

# FTP uses the following ports:
# Control channel:  21/tcp
# Active mode data: 20/tcp (server → client)
# Passive mode data: high ports (server → client connects to server)

# Connect to an FTP server
$ ftp 192.168.1.10
Connected to 192.168.1.10.
220 Welcome to the FTP server.
Name (192.168.1.10:user): admin
331 Please specify the password.
Password:
230 Login successful.
ftp> ls
drwxr-xr-x  2 admin admin  4096 Jan 15 10:30 documents
-rw-r--r--  1 admin admin  2048 Jan 15 09:15 readme.txt
ftp> get readme.txt
200 PORT command successful.
150 Opening ASCII mode data connection.
226 Transfer complete.

# Active mode vs. Passive mode
# Active:  Client sends PORT command, server connects back to client
# Passive: Client sends PASV command, server opens high port, client connects

FTP is suitable for scenarios where you need to provide file upload/download access to external users who may not have operating system-level accounts, such as web hosting file uploads, anonymous public file distribution, or batch file transfers between systems. For security, always use FTPS (FTP over TLS) or consider SFTP (SSH File Transfer Protocol) as a modern alternative.

Protocol Comparison and Port Summary

Choosing the right file sharing protocol depends on your specific requirements. The following comparison highlights the key differences:

# Protocol Comparison Table
#
# Feature           NFS              SMB/CIFS          FTP
# ─────────────────────────────────────────────────────────────
# Primary OS        Linux/Unix       Windows/Linux     Any
# Transparency      Mount as local   Mount or client   Client only
# Authentication    Kerberos/host    User/AD/Kerberos  User/anonymous
# Encryption        Kerberos/TLS     SMB3 built-in     FTPS (TLS)
# Printer sharing   No               Yes               No
# Port(s)           2049/tcp (v4)    445/tcp            21/tcp + data
# Firewall ease     Easy (v4)        Easy               Complex (active)
# Performance       Excellent        Very good          Good
# Use case          Unix-to-Unix     Cross-platform     File transfer

# Firewall rules example (UFW on Ubuntu)
$ sudo ufw allow from 192.168.1.0/24 to any port 2049 proto tcp  # NFS
$ sudo ufw allow from 192.168.1.0/24 to any port 445 proto tcp   # SMB
$ sudo ufw allow 21/tcp                                           # FTP control
$ sudo ufw allow 30000:31000/tcp                                  # FTP passive
  • Choose NFS when: All clients are Linux/Unix, you need POSIX permissions, and you want transparent file system mounting with minimal overhead.
  • Choose SMB when: You have Windows clients, need Active Directory integration, or want combined file and printer sharing.
  • Choose FTP when: You need to provide file upload/download to external users, anonymous access to public files, or simple batch transfers.
  • Consider SFTP/SCP when: You already have SSH access and need secure file transfers without deploying additional services.

Key Takeaways

  • NFS is the native Linux file sharing protocol; NFSv4 uses a single port (2049/tcp) and supports Kerberos authentication for secure, transparent file system access.
  • SMB/CIFS is essential for Windows interoperability; Samba on Linux implements the full SMB stack including file sharing, printer sharing, and Active Directory services.
  • FTP provides simple file transfer capabilities but requires careful firewall configuration for active/passive modes; always use TLS encryption in production.
  • Protocol choice depends on your client ecosystem, security requirements, and whether you need transparent mounting or explicit file transfers.
  • Modern best practices favor NFSv4 for Linux-to-Linux sharing, SMB3 for cross-platform environments, and SFTP over traditional FTP for secure transfers.

What’s Next

In the next lesson, you will learn how to set up and configure an NFS server and client on Ubuntu, including exports configuration, mount options, and automounting with autofs.

繁體中文

概述

  • 學習目標:了解 Linux 環境中使用的主要檔案共享協定 — NFS、SMB/CIFS 和 FTP — 包括其架構、優缺點及所需網路連接埠。
  • 先決條件:基本的 Linux 命令列技能,了解 TCP/IP 網路基礎
  • 預計閱讀時間:15 分鐘

簡介

檔案共享是網路伺服器提供的最基本服務之一。無論您是將設定檔分發到一組 Linux 機器、為辦公室的 Windows 桌面提供共享儲存空間,還是允許遠端使用者上傳內容,您都需要一個符合效能、安全性和相容性要求的協定。

Linux 原生支援多種檔案共享協定,每種協定都是為不同的場景設計的。網路檔案系統 (NFS) 是 Unix 對 Unix 共享的傳統選擇,伺服器訊息區塊 (SMB/CIFS) 可實現與 Windows 用戶端的互通性,而檔案傳輸協定 (FTP) 提供了一種簡單的網路檔案傳輸機制。在深入各自的設定之前,了解何時以及為何使用每種協定至關重要。

在本課程中,我們將檢視每種協定的架構、並列比較其功能、檢視它們使用的網路連接埠,並討論真實世界的使用案例,以幫助您為任何給定場景選擇正確的協定。

NFS — 網路檔案系統

NFS 由 Sun Microsystems 於 1980 年代開發,已成為 Unix 和 Linux 環境中的標準檔案共享協定。目前的生產版本是 NFSv4,它引入了重大改進,包括有狀態操作、透過 Kerberos 的整合安全性,以及適用於防火牆的單一 TCP 連接埠。

NFS 基於客戶端-伺服器模型運作。伺服器透過在設定中列出目錄來匯出它們,客戶端掛載這些匯出的目錄,就如同它們是本地檔案系統一樣。這種透明性是 NFS 最大的優勢之一 — 客戶端上的應用程式不需要知道它們正在存取遠端檔案。

# NFS 使用以下連接埠:
# NFSv3: portmapper (111/tcp,udp), nfsd (2049/tcp,udp),
#         mountd (動態), statd (動態), lockd (動態)
# NFSv4: nfsd (2049/tcp) — 僅單一連接埠

# 檢查 NFS 伺服器狀態
$ rpcinfo -p localhost
   program vers proto   port  service
    100000    4   tcp    111  portmapper
    100003    4   tcp   2049  nfs
    100005    3   tcp  20048  mountd

# 檢視伺服器的匯出清單
$ showmount -e 192.168.1.10
Export list for 192.168.1.10:
/srv/shared  192.168.1.0/24
/srv/home    *.example.com

NFS 最適合同質的 Linux/Unix 環境,在需要具有 POSIX 權限支援的透明檔案系統存取時使用。典型使用案例包括跨多台伺服器的共享主目錄、集中式應用程式資料,以及容器和虛擬機器的 NFS 後端儲存。

NFS 版本比較

  • NFSv3:無狀態協定,使用多個連接埠(需要 RPC portmapper),支援 UDP 和 TCP,依靠外部鎖定機制 NLM。仍被廣泛使用,但較難設定防火牆。
  • NFSv4:有狀態協定,單一連接埠 (2049/tcp),內建鎖定和委託,透過 RPCSEC_GSS 強制安全性支援 Kerberos,複合操作提升 WAN 效能。建議用於所有新部署。
  • NFSv4.1/4.2:新增平行 NFS (pNFS) 用於叢集儲存、伺服器端複製、稀疏檔案支援及改進的工作階段管理。

SMB/CIFS — 伺服器訊息區塊

SMB 是 Windows 生態系統的原生檔案共享協定。最初由 IBM 開發,後來由 Microsoft 擴展,現在是一個開放標準。在 Linux 上,Samba 專案提供了 SMB 協定的伺服器和客戶端實作,實現 Linux 和 Windows 系統之間的無縫檔案共享。

SMB 比 NFS 更為複雜,因為它是為包含使用者級認證、存取控制清單 (ACL)、印表機共享和服務探索的環境設計的。現代 SMB 版本 (SMB2 和 SMB3) 提供了顯著的效能改進、加密和多通道支援。

# SMB 使用以下連接埠:
# NetBIOS 名稱服務:   137/udp
# NetBIOS 資料報:     138/udp
# NetBIOS 工作階段 / SMB:139/tcp
# SMB over TCP(直接):445/tcp
# SMB2/SMB3 專用連接埠 445/tcp

# 測試與 SMB 伺服器的連線
$ smbclient -L //192.168.1.10 -U guest
Sharename       Type      Comment
---------       ----      -------
shared          Disk      Public Files
printers        Printer   All Printers
IPC$            IPC       IPC Service

# 在 Linux 上掛載 SMB 共享
$ sudo mount -t cifs //192.168.1.10/shared /mnt/shared 
    -o username=admin,password=secret,vers=3.0

當您的環境包含 Windows 用戶端、需要整合印表機共享或需要基於 Active Directory 的認證時,SMB 是正確的選擇。Linux 上的 Samba 甚至可以作為完整的 Active Directory 網域控制站。

FTP — 檔案傳輸協定

FTP 是最古老的網際網路協定之一,可追溯到 1971 年。它提供了一種直接的檔案上傳和下載機制。與 NFS 和 SMB 不同,FTP 不提供透明的檔案系統存取 — 客戶端明確地連線、瀏覽並使用專用 FTP 命令傳輸檔案。

FTP 使用兩個通道操作:控制通道(連接埠 21)用於命令,資料通道用於實際檔案傳輸。資料通道可以在主動模式(伺服器回連客戶端)或被動模式(客戶端連線到伺服器)下操作,這對防火牆設定有重大影響。

# FTP 使用以下連接埠:
# 控制通道:  21/tcp
# 主動模式資料:20/tcp(伺服器 → 客戶端)
# 被動模式資料:高連接埠(客戶端連線到伺服器)

# 連線到 FTP 伺服器
$ ftp 192.168.1.10
Connected to 192.168.1.10.
220 Welcome to the FTP server.
Name (192.168.1.10:user): admin
331 Please specify the password.
Password:
230 Login successful.
ftp> ls
drwxr-xr-x  2 admin admin  4096 Jan 15 10:30 documents
-rw-r--r--  1 admin admin  2048 Jan 15 09:15 readme.txt

FTP 適用於需要向外部使用者提供檔案上傳/下載存取權限的場景,例如網站託管檔案上傳、匿名公開檔案分發或系統之間的批次檔案傳輸。為了安全起見,請始終使用 FTPS (FTP over TLS) 或考慮使用 SFTP (SSH 檔案傳輸協定) 作為現代替代方案。

協定比較與連接埠摘要

選擇正確的檔案共享協定取決於您的具體需求。以下比較突出了主要差異:

# 協定比較表
#
# 功能             NFS              SMB/CIFS          FTP
# ─────────────────────────────────────────────────────────────
# 主要作業系統     Linux/Unix       Windows/Linux     任何
# 透明性           掛載為本地       掛載或客戶端       僅客戶端
# 認證             Kerberos/主機    使用者/AD/Kerberos 使用者/匿名
# 加密             Kerberos/TLS     SMB3 內建         FTPS (TLS)
# 印表機共享       否               是                 否
# 連接埠           2049/tcp (v4)    445/tcp            21/tcp + 資料
# 防火牆易用性     容易 (v4)        容易               複雜(主動)
# 效能             優秀             非常好             良好
# 使用案例         Unix 對 Unix     跨平台             檔案傳輸

# 防火牆規則範例(Ubuntu 上的 UFW)
$ sudo ufw allow from 192.168.1.0/24 to any port 2049 proto tcp  # NFS
$ sudo ufw allow from 192.168.1.0/24 to any port 445 proto tcp   # SMB
$ sudo ufw allow 21/tcp                                           # FTP 控制
$ sudo ufw allow 30000:31000/tcp                                  # FTP 被動
  • 選擇 NFS 時機:所有客戶端都是 Linux/Unix,需要 POSIX 權限,且需要以最低開銷進行透明的檔案系統掛載。
  • 選擇 SMB 時機:有 Windows 客戶端,需要 Active Directory 整合,或需要合併檔案和印表機共享。
  • 選擇 FTP 時機:需要向外部使用者提供檔案上傳/下載、匿名存取公開檔案,或簡單的批次傳輸。
  • 考慮 SFTP/SCP 時機:已有 SSH 存取權限,需要安全的檔案傳輸而不需部署額外服務。

重點摘要

  • NFS 是 Linux 原生的檔案共享協定;NFSv4 使用單一連接埠 (2049/tcp) 並支援 Kerberos 認證,用於安全、透明的檔案系統存取。
  • SMB/CIFS 對於 Windows 互通性至關重要;Linux 上的 Samba 實作了完整的 SMB 堆疊,包括檔案共享、印表機共享和 Active Directory 服務。
  • FTP 提供簡單的檔案傳輸功能,但主動/被動模式需要仔細的防火牆設定;在生產環境中始終使用 TLS 加密。
  • 協定選擇取決於您的客戶端生態系統、安全需求,以及您需要的是透明掛載還是明確的檔案傳輸。
  • 現代最佳實踐偏好使用 NFSv4 進行 Linux 對 Linux 共享,SMB3 用於跨平台環境,SFTP 取代傳統 FTP 進行安全傳輸。

下一步

在下一課中,您將學習如何在 Ubuntu 上設定和配置 NFS 伺服器與客戶端,包括匯出設定、掛載選項以及使用 autofs 進行自動掛載。

日本語

概要

  • 学習内容:Linux 環境で使用される主要なファイル共有プロトコル — NFS、SMB/CIFS、FTP — のアーキテクチャ、長所・短所、必要なネットワークポートについて。
  • 前提条件:基本的な Linux コマンドラインスキル、TCP/IP ネットワーキングの基礎知識
  • 推定読了時間:15分

はじめに

ファイル共有は、ネットワークサーバーが提供する最も基本的なサービスの一つです。Linux マシン群への設定ファイルの配布、オフィスの Windows デスクトップへの共有ストレージの提供、リモートユーザーによるコンテンツのアップロードなど、パフォーマンス、セキュリティ、互換性の要件に合ったプロトコルが必要です。

Linux は複数のファイル共有プロトコルをネイティブにサポートしており、それぞれ異なるシナリオ向けに設計されています。Network File System (NFS) は Unix 間共有の伝統的な選択肢、Server Message Block (SMB/CIFS) は Windows クライアントとの相互運用を可能にし、File Transfer Protocol (FTP) はネットワーク経由のファイル転送のシンプルなメカニズムを提供します。各プロトコルの個別設定に進む前に、いつ、なぜ各プロトコルを使用するかを理解することが不可欠です。

このレッスンでは、各プロトコルのアーキテクチャを検討し、機能を並べて比較し、使用するネットワークポートを確認し、実際のユースケースについて議論して、あらゆるシナリオに適したプロトコルを選択できるようにします。

NFS — ネットワークファイルシステム

NFS は 1980 年代に Sun Microsystems によって開発され、Unix および Linux 環境における標準的なファイル共有プロトコルとなりました。現在の本番バージョンは NFSv4 で、ステートフルな動作、Kerberos による統合セキュリティ、ファイアウォールに優しい単一 TCP ポートなど、NFSv3 からの大幅な改善が導入されています。

NFS はクライアント-サーバーモデルで動作します。サーバーは設定にディレクトリを列挙してエクスポートし、クライアントはそれらのエクスポートされたディレクトリをローカルファイルシステムと同様にマウントします。この透過性は NFS の最大の強みの一つです — クライアント上のアプリケーションはリモートファイルにアクセスしていることを知る必要がありません。

# NFS が使用するポート:
# NFSv3: portmapper (111/tcp,udp), nfsd (2049/tcp,udp),
#         mountd (動的), statd (動的), lockd (動的)
# NFSv4: nfsd (2049/tcp) — 単一ポートのみ

# NFS サーバーの状態を確認
$ rpcinfo -p localhost
   program vers proto   port  service
    100000    4   tcp    111  portmapper
    100003    4   tcp   2049  nfs
    100005    3   tcp  20048  mountd

NFS は、POSIX パーミッションをサポートする透過的なファイルシステムアクセスが必要な、同質の Linux/Unix 環境に最適です。

NFS バージョン比較

  • NFSv3:ステートレスプロトコル、複数のポートを使用(RPC portmapper が必要)、UDP と TCP をサポート、NLM による外部ロック。ファイアウォール設定が困難。
  • NFSv4:ステートフルプロトコル、単一ポート (2049/tcp)、組み込みロックとデリゲーション、Kerberos サポートによる必須セキュリティ、WAN パフォーマンス向上のための複合操作。すべての新規デプロイメントに推奨。
  • NFSv4.1/4.2:クラスタストレージ用の pNFS、サーバーサイドコピー、スパースファイルサポート、改善されたセッション管理を追加。

SMB/CIFS — サーバーメッセージブロック

SMB は Windows エコシステムのネイティブファイル共有プロトコルです。元々 IBM が開発し、後に Microsoft が拡張したもので、現在はオープンスタンダードです。Linux では、Samba プロジェクトが SMB プロトコルのサーバーとクライアント両方の実装を提供し、Linux と Windows システム間のシームレスなファイル共有を可能にしています。

SMB は、ユーザーレベルの認証、アクセス制御リスト (ACL)、プリンター共有、サービスディスカバリーを含む環境向けに設計されたため、NFS よりも複雑なプロトコルです。

# SMB が使用するポート:
# NetBIOS 名前サービス:   137/udp
# NetBIOS データグラム:   138/udp
# NetBIOS セッション / SMB:139/tcp
# SMB over TCP(ダイレクト):445/tcp

# SMB サーバーへの接続テスト
$ smbclient -L //192.168.1.10 -U guest
Sharename       Type      Comment
---------       ----      -------
shared          Disk      Public Files
printers        Printer   All Printers
IPC$            IPC       IPC Service

SMB は、Windows クライアントを含む環境、統合プリンター共有が必要な場合、または Active Directory ベースの認証が必要な場合に適しています。

FTP — ファイル転送プロトコル

FTP は 1971 年に遡る最も古いインターネットプロトコルの一つです。NFS や SMB とは異なり、FTP は透過的なファイルシステムアクセスを提供しません。クライアントは明示的に接続し、閲覧し、専用の FTP コマンドを使用してファイルを転送します。

FTP は 2 つのチャネルで動作します:コマンド用の制御チャネル(ポート 21)と実際のファイル転送用のデータチャネル。データチャネルはアクティブモード(サーバーがクライアントに接続)またはパッシブモード(クライアントがサーバーに接続)で動作でき、ファイアウォール設定に大きな影響を与えます。

# FTP が使用するポート:
# 制御チャネル:  21/tcp
# アクティブモードデータ:20/tcp(サーバー → クライアント)
# パッシブモードデータ:高ポート(クライアントがサーバーに接続)

# FTP サーバーに接続
$ ftp 192.168.1.10
Connected to 192.168.1.10.
220 Welcome to the FTP server.
Name (192.168.1.10:user): admin
331 Please specify the password.
Password:
230 Login successful.

FTP は、外部ユーザーにファイルのアップロード/ダウンロードアクセスを提供する必要がある場合に適しています。セキュリティのために、常に FTPS (FTP over TLS) を使用するか、モダンな代替手段として SFTP を検討してください。

プロトコル比較とポート一覧

# プロトコル比較表
#
# 機能             NFS              SMB/CIFS          FTP
# ─────────────────────────────────────────────────────────────
# 主要 OS          Linux/Unix       Windows/Linux     すべて
# 透過性           ローカルマウント マウントまたは     クライアントのみ
#                                   クライアント
# 認証             Kerberos/ホスト  ユーザー/AD       ユーザー/匿名
# 暗号化           Kerberos/TLS     SMB3 内蔵         FTPS (TLS)
# プリンター共有   なし             あり               なし
# ポート           2049/tcp (v4)    445/tcp            21/tcp + データ
  • NFS を選択する場合:すべてのクライアントが Linux/Unix で、POSIX パーミッションが必要で、最小限のオーバーヘッドで透過的なファイルシステムマウントが必要な場合。
  • SMB を選択する場合:Windows クライアントがある場合、Active Directory 統合が必要な場合、またはファイルとプリンターの統合共有が必要な場合。
  • FTP を選択する場合:外部ユーザーにファイルのアップロード/ダウンロードを提供する必要がある場合、または簡単なバッチ転送が必要な場合。
  • SFTP/SCP を検討する場合:すでに SSH アクセスがあり、追加サービスをデプロイせずにセキュアなファイル転送が必要な場合。

重要ポイント

  • NFS は Linux ネイティブのファイル共有プロトコルです。NFSv4 は単一ポート (2049/tcp) を使用し、Kerberos 認証をサポートします。
  • SMB/CIFS は Windows との相互運用に不可欠です。Linux 上の Samba はファイル共有、プリンター共有、Active Directory サービスを含む完全な SMB スタックを実装しています。
  • FTP はシンプルなファイル転送機能を提供しますが、アクティブ/パッシブモードの慎重なファイアウォール設定が必要です。本番環境では常に TLS 暗号化を使用してください。
  • プロトコルの選択は、クライアントエコシステム、セキュリティ要件、透過的マウントか明示的ファイル転送かによって異なります。
  • モダンなベストプラクティスでは、Linux 間共有には NFSv4、クロスプラットフォーム環境には SMB3、セキュアな転送には従来の FTP よりも SFTP が推奨されます。

次のステップ

次のレッスンでは、Ubuntu で NFS サーバーとクライアントをセットアップおよび設定する方法を学びます。エクスポート設定、マウントオプション、autofs による自動マウントについて学習します。

You Missed