CachyOS File Sharing - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
CachyOS File Sharing Guide
Complete beginner-friendly guide to file sharing on CachyOS, including Samba (Windows file sharing), NFS, and network file sharing setup.
Table of Contents
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
Installing Samba
Install Samba:
sudo pacman -S samba
What this does:
- Installs Samba server
- Provides file sharing
- Makes sharing available
Start Samba:
sudo systemctl enable --now smb.service nmb.service
What this does:
- Enables Samba at boot
- Starts Samba services
- Makes shares available
Configuring Samba
Edit Samba config:
sudo nano /etc/samba/smb.conf
Add share:
[myshare]
path = /path/to/share
valid users = username
writable = yes
browseable = yes
What this means:
[myshare]: Share namepath: Directory to sharevalid users: Allowed userswritable: Allow writingbrowseable: Visible in network
Create Samba user:
sudo smbpasswd -a username
What this does:
- Adds user to Samba
- Sets Samba password
- Required for access
Restart Samba:
sudo systemctl restart smb.service nmb.service
What this does:
- Applies configuration
- Makes shares available
- Updates Samba
NFS Setup
What is NFS?
NFS (Network File System) is Linux file sharing.
What it does:
- Linux-native: Native Linux file sharing
- Fast: Good performance
- Unix-like: Works well on Linux/Unix
- Simple: Easy configuration
Installing NFS
Install NFS:
sudo pacman -S nfs-utils
What this does:
- Installs NFS server
- Provides NFS sharing
- Makes sharing available
Start NFS:
sudo systemctl enable --now nfs-server.service
What this does:
- Enables NFS at boot
- Starts NFS server
- Makes shares available
Configuring NFS
Edit exports:
sudo nano /etc/exports
Add export:
/path/to/share 192.168.1.0/24(rw,sync,no_subtree_check)
What this means:
/path/to/share: Directory to share192.168.1.0/24: Allowed networkrw: Read-write accesssync: Synchronous writes
Export shares:
sudo exportfs -ra
What this does:
- Exports all shares
- Applies exports file
- Makes shares available
Accessing Shared Files
Accessing Samba Shares
From file manager:
- Open file manager
- Go to "Network" or "Browse Network"
- Find Samba server
- Enter credentials
- Access shares
From command line:
smbclient //server/share -U username
What this does:
- Connects to Samba share
- Prompts for password
- Access share
Mount Samba share:
sudo mount -t cifs //server/share /mnt -o username=user
What this does:
- Mounts Samba share
- Makes accessible at /mnt
- Requires credentials
Accessing NFS Shares
Mount NFS share:
sudo mount -t nfs server:/path/to/share /mnt
What this does:
- Mounts NFS share
- Makes accessible at /mnt
- Network file access
Permanent mount:
sudo nano /etc/fstab
Add:
server:/path/to/share /mnt nfs defaults 0 0
What this does:
- Mounts at boot
- Permanent access
- Auto-mounts
Troubleshooting
Samba Not Working
Check Samba status:
sudo systemctl status smb
What this does:
- Shows Samba status
- Verifies it's running
- Helps troubleshoot
Check firewall:
sudo firewall-cmd --list-services
What this does:
- Lists allowed services
- Samba may be blocked
- Allow Samba if needed
Allow Samba:
sudo firewall-cmd --add-service=samba --permanent
sudo firewall-cmd --reload
What this does:
- Allows Samba through firewall
- Makes shares accessible
- Fixes firewall issues
NFS Not Working
Check NFS status:
sudo systemctl status nfs-server
What this does:
- Shows NFS status
- Verifies it's running
- Helps troubleshoot
Check exports:
sudo exportfs -v
What this does:
- Shows exported shares
- Verifies exports
- Helps troubleshoot
Additional Resources
- CachyOS Network Configuration - Network setup
- CachyOS Security Configuration - Security settings
- Arch Linux Wiki - Samba: https://wiki.archlinux.org/title/Samba
- Arch Linux Wiki - NFS: https://wiki.archlinux.org/title/NFS
Summary
This guide covered:
- Understanding file sharing - What it is and why use it
- Samba setup - Windows-compatible file sharing
- NFS setup - Linux file sharing
- Accessing shares - How to access shared files
- Troubleshooting - Common file sharing issues
Key Takeaways:
- Samba for Windows compatibility
- NFS for Linux-native sharing
- Configure shares in config files
- Set up users and permissions
- Allow through firewall
- Mount shares for easy access
- Test connectivity if issues occur
This guide is based on the CachyOS Wiki and Arch Linux Wiki and expanded with detailed explanations for beginners. For the most up-to-date file sharing information, always refer to the official documentation.