How to Share Folders on a Network — Quick, Secure Setup for Windows, macOS & Linux

How to Share Folders on a Network — Quick, Secure Setup for Windows, macOS & Linux

Network file sharing makes collaboration and backups simple, but doing it quickly and securely means choosing the right protocol, locking down permissions, and using the OS-specific tools that work best. This guide walks you through practical, step-by-step setups for Windows, macOS, and Linux so you can share folders fast without exposing your network.

Network file sharing is a foundational capability for webmasters, IT teams, and developers: it enables collaborative workflows, centralized backups, and service deployment. Setting up shared folders quickly is straightforward, but doing so securely and with proper access control requires attention to protocol choices, OS-specific tools, and network hardening. This article walks through practical, technical steps to share folders on Windows, macOS, and Linux networks, explains how the underlying mechanisms work, outlines typical use cases, compares advantages, and offers purchasing guidance for hosting and remote-file-sharing scenarios.

How file sharing works: core principles

At its simplest, network file sharing exposes a filesystem namespace on one host so that other hosts can access files over IP. Two key layers determine behavior:

  • Transport and protocol layer — SMB/CIFS (Windows-native), NFS (Unix/Linux-native), SFTP/FTP/SSH (session-oriented file access), and WebDAV (HTTP-based).
  • Authorization and filesystem layer — how the server enforces permissions (POSIX permissions, ACLs, Windows ACLs), and whether authentication is per-user, per-group, or anonymous.

Important operational distinctions:

  • Share permissions (protocol-level) vs filesystem permissions (OS-level). Both apply and the most restrictive wins.
  • Network protocol security: SMBv1 is insecure and deprecated; SMBv2/3 add performance and encryption; NFSv4 adds stronger authentication (Kerberos) and ACL support.
  • Transport protection: use encryption (SMB3 encryption, SSH/SFTP, TLS for WebDAV) and VPNs for cross-site sharing.

Common application scenarios

  • Small office file server — shared project folders, centralized backups, user home directories.
  • Developer collaboration — shared build artifacts, test datasets, and remote mount for CI jobs.
  • Media editing and streaming — high throughput file access; choose protocols and networks that minimize latency.
  • Remote access over Internet — use SFTP or a VPN to a VPS/host rather than exposing SMB/NFS directly to the public Internet.

Windows: Quick, secure SMB share setup

Windows uses SMB (Server Message Block). For modern, secure setups, prefer SMBv3 and avoid SMBv1.

Step-by-step: create a share (Windows 10/11/Server)

  • Right-click the folder > Properties > Sharing > Advanced Sharing. Check “Share this folder”.
  • Set the share name, click Permissions, and add users/groups with Read, Change, or Full Control. Remember this is the share permission.
  • Click Security to adjust NTFS permissions (filesystem level). Ensure the user accounts have matching NTFS rights.
  • On the network/protocol side: ensure Server Message Block is enabled and that SMBv1 is disabled via “Turn Windows features on or off”. Use Group Policy to require SMBv2/3 if needed.
  • Enable Windows Firewall rules for “File and Printer Sharing”. For domain environments, use Group Policy to restrict allowed subnets or servers.

Security best practices (Windows)

  • Disable SMBv1 system-wide. In PowerShell: Disable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol.
  • Require SMB signing and SMB encryption where possible (Server Message Block settings via Group Policy or registry) to prevent man-in-the-middle attacks.
  • Use strong local/domain accounts and avoid sharing to “Everyone”. Prefer per-user authentication; use Active Directory for centralized management.
  • Use NTFS ACLs to segregate rights and audit access events via Windows Security logs.

macOS: sharing with SMB and AFP (note on deprecation)

macOS supports SMB natively and historically supported AFP. Modern macOS favors SMB for cross-platform interoperability.

Setup: enable File Sharing and configure SMB

  • System Preferences > Sharing > File Sharing. Click the + to add the folder, assign users and privileges (Read & Write, Read Only, Write Only, or Custom).
  • Click Options and enable “Share files and folders using SMB”. Select which user accounts are allowed and enter passwords when prompted.
  • On the client side, use Finder > Go > Connect to Server (smb://hostname/share) or mount using mount_smbfs from the terminal.

Security considerations (macOS)

  • SMB signing and encryption are handled by macOS automatically for SMB3-capable servers; verify with smbutil statshares -a.
  • Ensure only intended user accounts are enabled for sharing. Avoid enabling guest share unless isolated to a VLAN.
  • Consider using macOS’s built-in TCC/Privacy controls and full-disk encryption (FileVault) to protect local data at rest.

Linux: Samba and NFS — which to choose and how to set up

Linux offers multiple options: Samba for SMB/CIFS compatibility with Windows and macOS, NFS for native Unix-style sharing, and SFTP/SSHFS for secure remote mounts over SSH.

Samba quick setup (Debian/Ubuntu example)

  • Install: sudo apt update && sudo apt install samba.
  • Create a sharable directory and set ownership/permissions: sudo mkdir -p /srv/samba/projects && sudo chown root:smbgroup /srv/samba/projects && sudo chmod 2770 /srv/samba/projects. Using the setgid bit (2) helps maintain group ownership for new files.
  • Add Samba group and users: sudo groupadd smbgroup && sudo usermod -aG smbgroup alice && sudo smbpasswd -a alice.
  • Edit /etc/samba/smb.conf to add a share block:
    [projects]
       path = /srv/samba/projects
       browseable = yes
       read only = no
       valid users = @smbgroup
       create mask = 0660
       directory mask = 2770
       smb encrypt = required
       vfs objects = acl_xattr
       

    Key directives: smb encrypt = required forces SMB encryption (SMB3), and acl_xattr helps map Windows ACLs.

  • Restart Samba: sudo systemctl restart smbd nmbd. Open firewall ports (TCP 445, 139) only on trusted networks.

NFS quick setup

  • Install: sudo apt install nfs-kernel-server.
  • Add export to /etc/exports, e.g.: /srv/nfs/projects 10.0.0.0/24(rw,sync,no_subtree_check,fsid=0).
  • Start the service: sudo exportfs -ra && sudo systemctl restart nfs-kernel-server. Client mounts with mount -t nfs server:/srv/nfs/projects /mnt/projects.
  • For secure authentication, use NFSv4 with Kerberos (sec=krb5, krb5i, krb5p) integrated with an ID backend (LDAP/AD).

Linux security notes

  • SELinux/AppArmor: if enabled, ensure correct file contexts and profiles. For SELinux, use chcon or semanage fcontext to set contexts, then restorecon.
  • Filesystem ACLs: use getfacl/setfacl for fine-grained permissions beyond POSIX bits.
  • Restrict Samba/NFS ports at the host firewall (ufw/iptables) and at network edge. Consider running shares only on private networks or behind a VPN.

Advanced security: when to use VPN, SFTP, or Kerberos

For cross-site or Internet-accessible sharing, avoid exposing SMB/NFS directly. Better options:

  • VPN — Connect remote clients to the local network securely, then use existing SMB/NFS setup without public exposure.
  • SFTP/SSHFS — Uses SSH for authentication and encryption; suitable for per-user access and scripts. Example mount: sshfs user@server:/var/www /mnt/www.
  • Kerberos with NFSv4 or Samba AD join — For enterprise-grade single sign-on and mutual authentication, join Linux servers to an Active Directory domain or use a Kerberos KDC.
  • SMB3 Encryption — If you must use SMB over untrusted networks, force encryption (Samba: smb encrypt = required; Windows: enable SMB encryption per share).

Performance tuning tips

  • Use appropriate MTU and jumbo frames on LANs for large media transfers.
  • Tune Samba socket options, read raw/write raw and max protocol version for best throughput. Example: socket options = TCP_NODELAY SO_RCVBUF=131072 SO_SNDBUF=131072.
  • For NFS, adjust rsize/wsize on mount (e.g., 65536) and use async where safe for speed; be mindful of data integrity trade-offs.
  • Place frequently accessed shares on fast storage (NVMe/SATA RAID) and enable server-side caching where safe.

Comparative advantages: SMB vs NFS vs SFTP

  • SMB: best cross-platform support, rich ACLs, good for Windows-heavy environments; modern SMB3 supports encryption and high performance.
  • NFS: excellent for Unix/Linux performance and POSIX semantics; NFSv4 adds security and ACLs but requires more setup for Kerberos.
  • SFTP/SSHFS: very secure and simple to expose over the Internet; not ideal for heavy metadata-intensive workloads due to latency.

Choosing hosting and remote sharing infrastructure

For remote file sharing, backups, and centralized services, consider using a reliable VPS provider. Choose plans based on network throughput, disk performance, and geographic location relative to your users. Important considerations:

  • Bandwidth and network latency: choose a data center region close to users. For U.S.-focused teams, a provider with U.S. VPS locations reduces latency.
  • Storage performance: NVMe or SSD-backed disks significantly improve I/O compared to spinning disks.
  • Security features: provider firewalls, private networks, and snapshots/backups.
  • Ability to run custom services (Samba, SFTP, OpenVPN, WireGuard): ensure the VPS OS and kernel support what you need.

Summary

Establishing shared folders across Windows, macOS, and Linux is straightforward when you follow protocol-specific best practices: use SMBv2/3 for cross-platform compatibility with encryption, NFSv4 with Kerberos for Unix-centric environments, and SFTP/VPN for secure remote access. Always manage both share-level and filesystem-level permissions, secure network exposure with firewalls or VPNs, and use authentication mechanisms such as AD/Kerberos for centralized control.

For teams that require reliable remote storage and secure access, deploying services on a geographically appropriate VPS can be an effective approach. If you need U.S.-based hosting for low-latency access, consider a reliable option such as the USA VPS plans at VPS.DO, which provide the network performance and configuration flexibility suited to file-sharing and collaborative server workloads.

Fast • Reliable • Affordable VPS - DO It Now!

Get top VPS hosting with VPS.DO’s fast, low-cost plans. Try risk-free with our 7-day no-questions-asked refund and start today!