Class Topics‎ > ‎

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

posted Nov 20, 2011, 9:44 AM by Darin Miller   [ updated Dec 19, 2016, 8:55 PM ]
Background

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 kdesudo

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  
sudo smbpasswd -e $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
gksudo gedit /etc/samba/smb.conf

-- or --

kdesudo 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):
[Downloads]
        path = /home/darin/Downloads
        comment = darin's Downloads directory
        writeable = yes
        valid users = cathi, darin
        browseable = yes

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

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
   mainWindow.MainWindow(debug_flag)
 File "/usr/share/system-config-samba/mainWindow.py", 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/basicPreferencesWin.py", 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