Class Topics‎ > ‎

Samba Basics (file sharing including Window's PC's)

posted Nov 20, 2011, 9:44 AM by Darin Miller   [ updated Sep 16, 2017, 3:44 PM ]

What is Samba?
Samba is an implementation of the Server Message Block (SMB)/Common Internet File System (CIFS) protocol for Unix systems, providing support for cross-platform file and printer sharing with Microsoft Windows, OS X, and other Unix systems.

Ubuntu community documentation:

Other references:

Configuration and setup
Install samba setup files:
sudo apt-get install samba samba-common system-config-samba smbclient

Add user and add user to group:
sudo adduser <name>
sudo passwd <name>
sudo addgroup smb
sudo adduser $USER smb

Add and enable Samba user
sudo smbpasswd -a $USER  

Share setup (/etc/samba/smb.conf):

Samba GUI configuration:
Find the Samba icon (KDE: System or Settings menu or run "sudo system-config-samba", 1st time run you may need to sudo touch /etc/libuser.conf )
On the Basic tab:
  • Add a share
  • Set permissions
On the Access tab:
  • enable user shares and privileges
Manual configuration of the Network  resolution order is still needed! (see below).

-- or --

Manually Editing Samba config file
gedit /etc/samba/smb.conf

-- or --

kate /etc/samba/smb.conf

Change workgroup:
Change: workgroup = workgroup
To: workgroup = <your network group name>

Change Network resolution order in the [global] section
#  ** Note order is important!!
name resolve order = bcast host lmhosts wins
# Network broadcast name
netbios name = Imagined

Enable anonymous access to windows machines:
remove the ";" (semi-colon) from beginning of line "security = user"

and below the "security = user" line add a new line:
map to guest = Bad User

Specific Folder share example (add at the end of the file):
        path = /home/darin/Downloads
        comment = darin's Downloads directory
        writeable = yes
        valid users = cathi, darin
        browseable = yes

Restart Samba
        17.04 and beyond
                sudo systemctl unmask smbd
                sudo systemctl enable smbd
                sudo systemctl restart smbd

15.04, 15.10:
sudo /etc/init.d/samba restart
sudo restart smbd

Enable sharing on some ASUS routers:
Add the following lines to the [global] section of the /etc/samba/smb.conf file:
client NTLMv2 auth = no
client use spnego = no

Trouble shooting commands:

  • testparm -s
  • net usershare info
  • list samba users
    • sudo pdbedit -L -v | grep user

Running the Samba gui, if you see this error:

kdesudo system-config-samba
 File "/usr/share/system-config-samba/", line 121, in __init__
   self.basic_preferences_win = basicPreferencesWin.BasicPreferencesWin(self, self.xml, self.samba_data, self.samba_b
ackend, self.main_window)
 File "/usr/share/system-config-samba/", line 97, in __init__
   self.admin = libuser.admin()
SystemError: could not open configuration file `/etc/libuser.conf': No such file or directory

run this:
    sudo touch /etc/libuser.conf