How to install Samba on Xubuntu 12.10

How to install Samba on Xubuntu 12.10

This Xubuntu 12.10 tutorial will show you how to install Samba on Xubuntu 12.10. At the end we will have a simple file server using samba on Xubuntu 12.10. Before you go any further, please keep in mind that this is a simple file server which means I do not use domain logon features on Samba. I only use user level authentication that should be sufficient for most SOHO file server. 
Most steps on this tutorial done using command line with root privileges. 

A. Install Samba on Xubuntu 12.10

Install samba using this command below.
apt-get install samba samba-common
Now check and start samba if it not started.
service smbd status
service smbd start

B. Configure Samba

We need to edit samba configuration file in /etc/samba/smb.conf. Edit some sections such as workgroup name, authentication/security level and share definition. Here is my smb.conf content

[global]
   workgroup = UBUNTUPOP
   server string = %h server (Samba, Ubuntu)
   dns proxy = no
   log file = /var/log/samba/log.%m
   max log size = 1000
   syslog = 0
   panic action = /usr/share/samba/panic-action %d

####### Authentication #######
   security = user
   encrypt passwords = true
   passdb backend = tdbsam
   obey pam restrictions = yes
   unix password sync = yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
   pam password change = yes
   map to guest = bad user

#======================= Share Definitions =======================
[printers]
   comment = All Printers
   browseable = no
   path = /var/spool/samba
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700

[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = no

[Share]
   comment=This is the shared folder
   path=/mnt/share
   browseable=yes
   read only=no
   guest ok=no
   writeable=yes

C. Add new share

To add a new shared folder, we need to create a new directory for example /mnt/share
mkdir /mnt/share
chown -R root:users /mnt/share
chmod -R 776 /mnt/share
And now edit /etc/samba/smb.conf and add the following lines to the bottom (see example above)

[Share]
   comment=This is the shared folder
   path=/mnt/share
   browseable=yes
   read only=no
   guest ok=no
   writeable=yes

D. Add new samba user


For example I want to add new user name fitri to the system.
useradd -G users fitri
smbpasswd fitri
Now restart the samba
service smbd restart
Done. You can now access the shared folder from any computers.

2 comments

Excellent. Worked perfectly the first time with one minor fix. After installing the Samba packages, there are no users in the `smbpasswd` user repository. So, one must use the -a (add) command token before the user name in the smbpasswd command line:

smbpasswd -a fitri

One other point: I advise, before starting this procedure, removing all existing file and folder artifacts of Samba if a previous install had occurred (especially /etc/samba). In other words, start 100% clean. Samba might operate okay but the administrator could get confused by obsolete files and folders.