How to Set Up a Samba File Server
Introduction
Samba allows you to share files between Linux and Windows systems. This guide shows you how to set up a Samba file server on your Linux VPS.
Step-by-step Guide
- Update your package list
- sudo apt update
- Install Samba
- sudo apt install -y samba
- Create a directory to share
- sudo mkdir -p /srv/samba/share
- sudo chown nobody:nogroup /srv/samba/share
- sudo chmod 0775 /srv/samba/share
- Backup the original Samba config
- sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
- Edit the Samba configuration file
- sudo nano /etc/samba/smb.conf
- Add at the end:n
- [Share]
- path = /srv/samba/share
- browsable = yes
- read only = no
- guest ok = yes
- Restart Samba
- sudo systemctl restart smbd
- (Optional) Allow Samba through the firewall
- sudo ufw allow 'Samba'
- sudo ufw reload
Recommendations
- For private shares, create Samba users and set passwords with
sudo smbpasswd -a username. - Regularly back up your shared data.
- Monitor access logs for security.
Call To Action
eed a VPS for your file sharing needs? Check out our hosting plans: https://xernode.com/#pricing