Linux Samba File Server for a Windows Network

This is a new guide for using Samba on modern distributions with a Microsoft Windows network.

This page was created in 2017 and is under development.

Simple Samba file sharing server setup

This is a minimal Samba setup to let other machines access files on a Debian machine.

Install Samba Server

  1. apt-get install samba

Install Samba Client

  1. apt-get install samba-client

Configure the Samba daemon

Edit the Samba configuration file.

  1. nano /etc/samba/smb.conf

In the global section, check the name of the workgroup. It might be useful to know it when you'll try to connect from a Windows machine:

[global]

  ...
  workgroup = STURBAIN

Locate the home share definition:

[homes]

In that section you may enable read-write access to the home directories:

  read only = no

To share files in some other path on the system, add another share definition such as:

[ourfiles]

  comment = Some useful files
  read only = no
  locking = no
  path = /path_to_our_files
  guest ok = no

Add Samba users

Samba uses it's own password system so users need to be added by root. Note that the users have to exist in /etc/passwd

  1. smbpasswd -a me
  2. smbpasswd -a you

You will be prompted for a password for each of those users.

To list existing Samba users:

pdbedit -w -L

Restart the Samba daemon

  1. /etc/init.d/samba restart

or, if you are using systemd

  1. /usr/sbin/service smbd restart

Try to access the shares (as a normal user)

Try locally first, then from another machine on the network which also installed samba client. When prompted, use the password entered when adding the user to Samba.

To access my share:

$ smbclient //ourmachine/me

To access your share:

$ smbclient -U you //ourmachine/you

To access our shared(!) share:

$ smbclient //ourmachine/ourfiles

Resources

Last modified on 27 February 2017, at 14:17