Skip to content

Linux File Sharing

Mattscreative edited this page Dec 5, 2025 · 2 revisions

Linux File Sharing Guide

Complete beginner-friendly guide to file sharing on Linux, covering Arch Linux, CachyOS, and other distributions including Samba (Windows file sharing), NFS, and network file sharing setup.


Table of Contents

  1. Understanding File Sharing
  2. Samba Setup
  3. NFS Setup
  4. SSH File Sharing
  5. Accessing Shared Files
  6. Troubleshooting

Understanding File Sharing

What is File Sharing?

File sharing allows accessing files over network.

What it does:

  • Network access: Access files from other computers
  • Centralized storage: Share files from one location
  • Cross-platform: Works with Windows, Linux, macOS
  • Convenience: Easy file access

Why use file sharing:

  • Network storage: Central file storage
  • Backup: Network backups
  • Collaboration: Share files with others
  • Convenience: Access files from anywhere

Samba Setup

What is Samba?

Samba provides Windows-compatible file sharing.

What it does:

  • Windows compatibility: Works with Windows
  • SMB/CIFS protocol: Windows file sharing protocol
  • Cross-platform: Linux, Windows, macOS
  • Easy setup: Simple configuration

Install Samba

Install Samba:

# Arch/CachyOS
sudo pacman -S samba

# Debian/Ubuntu
sudo apt install samba

# Fedora
sudo dnf install samba

Enable Samba

Start services:

# Enable services
sudo systemctl enable --now smb.service nmb.service

# Check status
systemctl status smb nmb

Configure Samba

Edit config:

# Edit config
sudo vim /etc/samba/smb.conf

Example share:

[share]
    path = /home/user/share
    valid users = user
    read only = no
    browsable = yes

Create Samba User

Add user:

# Add Samba user
sudo smbpasswd -a username

# Enable user
sudo smbpasswd -e username

NFS Setup

Install NFS

Install NFS:

# Arch/CachyOS
sudo pacman -S nfs-utils

# Debian/Ubuntu
sudo apt install nfs-kernel-server

# Fedora
sudo dnf install nfs-utils

Enable NFS

Start service:

# Enable service
sudo systemctl enable nfs-server
sudo systemctl start nfs-server

# Check status
systemctl status nfs-server

Configure NFS

Edit exports:

# Edit exports
sudo vim /etc/exports

Example:

/home/user/share 192.168.1.0/24(rw,sync,no_subtree_check)

Export:

# Export shares
sudo exportfs -ra

SSH File Sharing

SSH File Transfer

Using SCP:

# Copy file
scp file.txt user@server:/path/

# Copy directory
scp -r directory user@server:/path/

SFTP

Using SFTP:

# Connect
sftp user@server

# Commands
put file.txt
get file.txt

Accessing Shared Files

Access Samba Share

From Linux:

# Install client
sudo pacman -S smbclient

# List shares
smbclient -L //server

# Mount share
sudo mount -t cifs //server/share /mnt/share -o username=user

From Windows:

\\server\share

Access NFS Share

Mount NFS:

# Mount NFS
sudo mount -t nfs server:/share /mnt/share

# Or in fstab
server:/share /mnt/share nfs defaults 0 0

Troubleshooting

Samba Not Working

Check service:

# Check status
systemctl status smb nmb

# Check logs
journalctl -u smb

Permission Issues

Fix permissions:

# Set permissions
sudo chmod 755 /path/to/share
sudo chown user:group /path/to/share

Summary

This guide covered file sharing for Arch Linux, CachyOS, and other distributions, including Samba, NFS, and SSH file sharing.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally