-
-
Notifications
You must be signed in to change notification settings - Fork 2
Linux File Sharing
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.
- Understanding File Sharing
- Samba Setup
- NFS Setup
- SSH File Sharing
- Accessing Shared Files
- Troubleshooting
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 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:
# Arch/CachyOS
sudo pacman -S samba
# Debian/Ubuntu
sudo apt install samba
# Fedora
sudo dnf install sambaStart services:
# Enable services
sudo systemctl enable --now smb.service nmb.service
# Check status
systemctl status smb nmbEdit config:
# Edit config
sudo vim /etc/samba/smb.confExample share:
[share]
path = /home/user/share
valid users = user
read only = no
browsable = yes
Add user:
# Add Samba user
sudo smbpasswd -a username
# Enable user
sudo smbpasswd -e usernameInstall NFS:
# Arch/CachyOS
sudo pacman -S nfs-utils
# Debian/Ubuntu
sudo apt install nfs-kernel-server
# Fedora
sudo dnf install nfs-utilsStart service:
# Enable service
sudo systemctl enable nfs-server
sudo systemctl start nfs-server
# Check status
systemctl status nfs-serverEdit exports:
# Edit exports
sudo vim /etc/exportsExample:
/home/user/share 192.168.1.0/24(rw,sync,no_subtree_check)
Export:
# Export shares
sudo exportfs -raUsing SCP:
# Copy file
scp file.txt user@server:/path/
# Copy directory
scp -r directory user@server:/path/Using SFTP:
# Connect
sftp user@server
# Commands
put file.txt
get file.txtFrom Linux:
# Install client
sudo pacman -S smbclient
# List shares
smbclient -L //server
# Mount share
sudo mount -t cifs //server/share /mnt/share -o username=userFrom Windows:
\\server\share
Mount NFS:
# Mount NFS
sudo mount -t nfs server:/share /mnt/share
# Or in fstab
server:/share /mnt/share nfs defaults 0 0Check service:
# Check status
systemctl status smb nmb
# Check logs
journalctl -u smbFix permissions:
# Set permissions
sudo chmod 755 /path/to/share
sudo chown user:group /path/to/shareThis guide covered file sharing for Arch Linux, CachyOS, and other distributions, including Samba, NFS, and SSH file sharing.
- Networking - Network setup
- Remote Desktop - Remote access
- Security Configuration - Security
- ArchWiki Samba: https://wiki.archlinux.org/title/Samba
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.