Ubuntu 10.04 Samba Standalone Server With tdbsam Backend

Want to support HowtoForge? Become a subscriber!
Submitted by falko (Contact Author) (Forums) on Fri, 2010-07-16 17:09. :: Ubuntu | Samba | Storage

Ubuntu 10.04 Samba Standalone Server With tdbsam Backend

Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Follow me on Twitter
Last edited 05/28/2010

This tutorial explains the installation of a Samba fileserver on Ubuntu 10.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. In the resulting setup, every user has his own home directory accessible via the SMB protocol and all users have a shared directory with read-/write access.

I do not issue any guarantee that this will work for you!


1 Preliminary Note

I'm using an Ubuntu 10.04 system here with the hostname server1.example.com and the IP address

I'm 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 to your server on the shell and install the Samba packages:

aptitude install libcups2 samba samba-common

Edit the smb.conf file:

vi /etc/samba/smb.conf

In the global section, remove the "#" at the beginning of the line security = user so that it looks like this:

# "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

This 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

Now I will add a share that is accessible by all users.

Create the 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

If you want all users to be able to read and write to their home directories via Samba, add the following lines to /etc/samba/smb.conf:

   comment = Home Directories
   browseable = no
   valid users = %S
   writable = yes
   create mask = 0700
   directory mask = 0700

Now we restart Samba:

/etc/init.d/smbd restart


4 Adding And Managing Users

In this example, I will 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

Set a password for tom in the Linux system user database. If the user tom should not be able to log in to the Linux system, skip this step.

passwd tom

-> Enter the password for the new user.

Now add the user to the Samba user database:

smbpasswd -a tom

-> Enter the 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.


5 Links

Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by rjm_cmyk (not registered) on Sat, 2010-09-18 11:36.

Having spent a week trying to fix a permissions/authorisation problem with a fresh install of e-box/webmin I gave up.

So I went back to basic did a fresh install of Ubuntu server + Samba and followed the instructions above. Took 15 mins after the install. Hence the yeahhhaaaaaaa.

 Proof if it was needed that doing the basics is a great way of learning stuff and getting things to work without layers of "help" and complexity.

 So thanks from ever so grateful I can have Sunday off Richard in London UK.

Submitted by jfgomez (registered user) on Thu, 2010-08-12 14:52.

This is a complete smb.conf [GLOBAL]netbios name = dominioserver string = Servidor de Dominioworkgroup = conasinf.comsecurity = userdont descend = .recycle[HOMES]comment = Recurso Personalbrowseable = novalid users = %Swritable = yescreate mask = 0700directory mask = 0700vfs object = recyclerecycle:config-file = /etc/samba/recycle.confrecycle:repository = .recyclerecycle:keeptree = Yesrecycle:versions = Yes[SAMBA]comment = Servidor de Archivospath = /home/sambavalid users = @usersforce group = userscreate mask = 0660directory mask = 0771writable = yesvfs object = recyclerecycle:config-file = /etc/samba/recycle.confrecycle:repository = .recyclerecycle:keeptree = Yesrecycle:versions = YesAs you can see this file uses a reference to the recycle.conf file:name = .recyclemode = KEEP_DIRECTORIES|VERSIONS|TOUCHmaxsize = 0exclude = *.tmp|*.TMP|*.temp|*.o|*.obj|~$*|*.~??|*.log|*.traceexcludedir = /tmp|/temp|/cachenoversions = *.ppt|*.dat|*.inidirectory_mode = 0700This configuration allow to keep the files after they are erased on a directory called .recycled

Submitted by ubuntubuzz (not registered) on Sat, 2010-07-17 02:35.
this is article i'm looking about, thanks for writing this..