Ubuntu 12.04 Samba Standalone Server With tdbsam Backend

The installation of a Samba fileserver on Ubuntu 12.04 and how to configure it to share files over the SMB protocol as well as how to add users. Samba is configured as a standalone server, not as a domain controller. not issue any guarantee that this will work for you.

1 Preliminary Note

an Ubuntu 12.04 system here with the hostname server1.example.com and the IP address

running all the steps in this tutorial with root privileges, so make sure you’re logged in as root

sudo su

2 Installing Samba

Connect the server on the shell and install the Samba packages

apt-get install libcups2 samba samba-common

Edit the smb.conf file

vi /etc/samba/smb.conf

remove the “#” at the beginning of the line security = user in the below

# "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
# in the samba-doc package for details.

   security = user
enables Linux system users to log in to the Samba server
Close the file and restart Samba
/etc/init.d/smbd restart

3 Adding Samba Shares

add a share that is accessible by all users

directory for sharing the files and change the group to the users group:

mkdir -p /home/shares/allusers
chown -R root:users /home/shares/allusers/
chmod -R ug+rwx,o+rx-w /home/shares/allusers/

At the end of the file /etc/samba/smb.conf add the following lines:

vi /etc/samba/smb.conf
  comment = All Users
  path = /home/shares/allusers
  valid users = @users
  force group = users
  create mask = 0660
  directory mask = 0771
  writable = yes
all users to be able to read and write to their home directories via Samba
   comment = Home Directories
   browseable = no
   valid users = %S
   writable = yes
   create mask = 0700
   directory mask = 0700
restart Samba:


4 Adding And Managing Users

add a user named tom. You can add as many users as you need in the same way, just replace the username tom with the desired username in the commands.

useradd tom -m -G users

password for tom

passwd tom

password for the new user. Now add the user to the Samba user database

smbpasswd -a tom

password for the new user. Now you should be able to log in from your Windows workstation with the file explorer (address is \\ or \\\tom for tom’s home directory) using the username tom and the chosen password and store files on the Linux server either in tom’s home directory or in the public shared directory

Leave a comment