← Volver al blog

How to Set Up a Samba File Server

  • Xernode
  • 1 min de lectura
  • 10 de abril de 2026
VPS linux vps samba file-server file-sharing windows

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

  1. Update your package list
    • sudo apt update
  2. Install Samba
    • sudo apt install -y samba
  3. Create a directory to share
    • sudo mkdir -p /srv/samba/share
    • sudo chown nobody:nogroup /srv/samba/share
    • sudo chmod 0775 /srv/samba/share
  4. Backup the original Samba config
    • sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
  5. 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
  6. Restart Samba
    • sudo systemctl restart smbd
  7. (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

Related Guides