← All tutorials

Small Business Server

Set up a shared office file server with Samba

Give your team one shared drive on Windows, using a Linux server and free software.

Intermediate10 min read5 steps

  1. InstallAdd Samba
  2. FolderCreate the share
  3. UsersAdd accounts
  4. ConnectMap the drive

What you need

  • An Ubuntu Server with a fixed IP address
  • A user account with sudo access
  • A backup plan, as described in the server planning tutorial
  1. Install Samba and create a group

    The group controls who can use the share. New files will belong to this group.

    sudo apt update
    sudo apt install -y samba
    sudo groupadd office
    sudo mkdir -p /srv/share/office
    sudo chown root:office /srv/share/office
    sudo chmod 2770 /srv/share/office
  2. Define the share

    Add this block to the end of /etc/samba/smb.conf. Only members of the office group can connect, and new files stay accessible to that group.

    [Office]
       path = /srv/share/office
       valid users = @office
       read only = no
       create mask = 0660
       directory mask = 2770
  3. Add users

    Each person needs a Linux user and a Samba password. Create a separate account for everyone rather than a shared login, so you can see who has access and remove it when they leave.

    sudo adduser --no-create-home --shell /usr/sbin/nologin rahim
    sudo usermod -aG office rahim
    sudo smbpasswd -a rahim
  4. Check the setup and restart

    testparm checks your configuration for mistakes. Then allow file sharing through the firewall for your office network only.

    testparm
    sudo systemctl restart smbd
    sudo ufw allow from 192.168.10.0/24 to any app Samba
  5. Connect from Windows

    In File Explorer, click This PC, then Map network drive, and enter the address below. Sign in with the Samba username and password, and create a test file from a second PC to confirm that it works.

    \\192.168.10.20\Office

    A shared drive is a common target for ransomware. Keep versioned backups away from the share itself, and test restoring them.

Want this set up for your business?

We can plan, build and hand it over to your team.

Discuss your setup ↗
Next tutorialGet alerted when your server or website goes down →