Setup Samba Server Using tdbsam Backend on RHEL/CentOS 6.3/5.8 and Fedora 17-12

Samba is an open source and most popular widely used program that enables end users to access Linux shared directory from any windows machine on the same network. Samba is also named as a network file system and can be installed on Linux/Unix operating systems. Samba itself is a client/server protocol of SMB ( Server Message Block) and CIFS (Common Internet File System). Using windows smbclient (GUI) or file explorer, end users can connect to Samba server from any windows workstations to access shared files and printers.

Samba Server Setup
Samba Server Setup

This tutorial explains how to setup Samba Server (fileserver) Using tdbsam Backend on RHEL 6.3/6.2/6.1/6/5.8, CentOS 6.3/6.2/6.1/6/5.8 and Fedora 17,16,15,14,13,12 systems and also we will learn how to configure it to share files over the network using SMB protocol, as well as we will see how to create and add system users on samba user’s database.

1. Preliminary Note

We are using RHEL 6.3 system with hostname tecmint with IP address

2. Disable SELinux

First, check whether SELinux is currently enabled or disabled with following command.

# selinuxenabled && echo enabled || echo disabled


In our case, SELinux is currently enabled, so we need to disabled it under RHEL/CentOS/Fedora systems, open file called /etc/selinux/config with your choice of editor. ( Ignore this step, if SELinux is already disabled ).

# vi /etc/selinux/config

And change the line that says SELINUX=enabled to SELINUX=disabled and reboot the system.

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.

3. Rebooting System

Here, we will need to reboot the system to re-lable entire file system in the boot process. This reboot process can take some time, depends on the volume of files.

# init 6

Once the system comes to login prompt, login with root user and start installing Samba package.

3. Installing Samba

We use YUM package manager tool to install Samba packages.

# yum install samba samba-common cups-libs samba-client

4. Configure Samba with tdbsam Backend

Once samba installed successfully, now time to configure it using tdbsam password backend. Open file /etc/samba/smb.conf.

# vi /etc/samba/smb.conf

And check for the following lines in the Standalone Server Options section. This line enables users to login into Samba server.

# ----------------------- Standalone Server Options ------------------------
# Scurity can be set to user, share(deprecated) or server(deprecated)
# Backend to store user information in. New installations should
# use either tdbsam or ldapsam. smbpasswd is available for backwards
# compatibility. tdbsam requires no further configuration.

        security = user 
        passdb backend = tdbsam

5. Creating Samba Share Directory

Now, we will create Samba share directory for sharing files for all users. Run the following commands.

# mkdir -p /home/sambashares/tecmintusers
# chown -R root:users /home/sambashares/tecmintusers
# chmod -R 775 /home/sambashares/tecmintusers

6. Configuring Samba Share Directory

Add following lines at the bottom of the file /etc/samba/smb.conf.

  comment = All Users
  path = /home/sambashares/tecmintusers
  valid users = @users
  force group = users
  create mask = 0660
  directory mask = 0771
  writable = yes

7. Creating Samba Start-up Links

Create system start-up links for Samaba.

# chkconfig --levels 235 smb on

8. Restarting Samba Server

Now restart Samba server.

# /etc/init.d/smb restart

9. Creating Samba Users

We will create a user called tecmint and set password to it.

# useradd tecmint -m -G users
# passwd tecmint

Now add newly created user tecmint to Samba user database and set password for him.

# smbpasswd -a tecmint

This way you can create as many as users you want, just replace the username tecmint with the desired username.

10. Verify Samba Server Share

Verify Samba share directory within Linux system using smbclient package with -L option. It will display list of available samba share directories on the host tecmint.

# smbclient -L tecmint

Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.5.10-125.el6]

        Sharename       Type      Comment
        ---------       ----      -------
        tecmintusers    Disk      All Users
        IPC$            IPC       IPC Service (Samba Server Version 3.5.10-125.el6)
Anonymous login successful
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.5.10-125.el6]

        Server               Comment
        ---------            -------

        Workgroup            Master
        ---------            -------

Try to login into Samba share directory under Linux system using username as tecmint with password.

# smbclient -L //tecmint/tecmintusers -U tecmint
Enter tecmint's password:
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.5.10-125.el6]

        Sharename       Type      Comment
        ---------       ----      -------
        tecmintusers     Disk      All Users
        IPC$            IPC       IPC Service (Samba Server Version 3.5.10-125.el6)
        tecmint         Disk      Home Directories
Domain=[MYGROUP] OS=[Unix] Server=[Samba 3.5.10-125.el6]

        Server               Comment
        ---------            -------

        Workgroup            Master
        ---------            -------

11. Login to Samba Server from Windows

Now try to login from your Windows system, open Windows Explorer and type the address \\\tecmint and enter username as tecmint and password, you will see tecmint’s home directory. Refer screenshot below.

Samba Share on Windows
Samba Share on Windows

Now to share Samba shared directory type address as \\\tecmintusers. You will see similar to below.

Samba Share Directory on Windows
Samba Share Directory on Windows

For more information about Samba configuration see the

If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts? do ask for help in the comments section.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

16 thoughts on “Setup Samba Server Using tdbsam Backend on RHEL/CentOS 6.3/5.8 and Fedora 17-12”

  1. I really think you should not disable Selinux, at most, put it in “permissive” mode, it won’t enforce security, but still log any issue!

  2. I am trying to install samba directory to use between my host CentOS 6.5 and VM Windows 7 enterprise. How do i connect to each machine through the virtual adapter?

  3. The purpose of that command is to change the context of file (i.e chcon) and samba_share_t is used to allow the given path required authority to be shared up via samba server (i.e between windows & linux)

  4. i am using oracle linux server 6.0 santigo
    i haveinstalled printer working in server, but could not print from windows pc and if printer connected to windows pc then also could not print. but i can exchange files (copy. paste delete) both in windows and linux.

    please help me

  5. # enforcing – SELinux security policy is enforced.
    # permissive – SELinux prints warnings instead of enforcing.
    # disabled – No SELinux policy is loaded.

    Why use disabled over permissive? Disabled means that SE security contexts are not created and that you cannot easily turn SE linux back on.

    Ideally we should have the SE contexts posted above, for those that want to turn it on (ie you have a server exposed to the web OR you care about security.

  6. k yar, Thanks. I could able to access from windows machine. But every day the first access to the share take 40-45 seconds delay, after that there is no more delay for that day. The next day again the same thing happens.

  7. yar, I got the error ‘Connection to bhshare failed (Error NT_STATUS_BAD_NETWORK_NAME)’ when executing ‘smbclient -L bhshare’

    • Don’t worry about that error, even I got the same while writing up this article. Try whether Samba is accessible from Windows machine.

  8. HI All,

    Just a question, how can you access through domain name?

    the example you provide is an IP


    i want know how in domain name



    how or where do you configure this kind of adjustment

  9. Hi Ravi,

    Needed your help in AD domain joining on RHEL 6.3 imaged desktops.

    We have multiple system imaged with RHEL v6.3 & want to join them in windows domain. Please help us.


Leave a Reply to Ravi Saive Cancel reply

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.