How to Install Samba Standalone Server with tdbsam Backend on CentOS 6.3

This guide explains the complete and step by step process of installing a Samba fileserver on CentOS 6.3, so you can configure it to share files on the SMB protocol. In addition, it also explains how to add users. Samba is configured as an individual server, and not as a domain controller. Consequently, every user owns home directory in the setup which can be accessible through the SMB protocol. Moreover, every user does have a shared directory with read-/write permissions. In order to start the procedure, use CentOS 6.3 system; the hostname server1.examle.com and the IP address 192.168.0.100 are examples here so add your own details where necessary.

Instructions

  • 1

    Installing Samba

    First of all, you have to get connected to your server via shell, and make sure to install the Samba packages:

    yum install cups-libs samba samba-common

    Edit the smb.conf file:

    vi /etc/samba/smb.conf

    You are advised to see the following lines in the [global] section:

    [...]

    # 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

    [...]
    This will allow the users of Linux system to log in to the Samba server.

    Now, make the system startup links for Samba and begin it:

    chkconfig --levels 235 smb on
    /etc/init.d/smb start

  • 2

    Adding Samba Shares

    Now, you have to include a share so that all the users can access it.

    Set up the directory for the purpose of sharing wp-content/uploads 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/

    Write the following lines at the end of the file /etc/samba/smb.conf

    vi /etc/samba/smb.conf

    [...]

    [allusers]

    comment = All Users

    path = /home/shares/allusers

    valid users = @users

    force group = users

    create mask = 0660

    directory mask = 0771

    writable = yes

    In order to allow all users to read and write to their home directories through Samba, include the following lines to /etc/samba/smb.conf:

    [...]

    [homes]

    comment = Home Directories

    browseable = no

    valid users = %S

    writable = yes

    create mask = 0700

    directory mask = 0700

    After that restart Samba:

    /etc/init.d/smb restart

  • 3

    Adding and Managing Users

    Now take an example, and add a user with the name of tom. You are allowed to add many users as you want by following the same procedure. All you need to replace the username tom with the required username in the commands.

    useradd tom -m -G users

    Now create a password for user tom in the Linux database. If you are unable to log with the user tom into the Linux system, then skip this step.

    passwd tom

    Now type the password for the new user. After that add the user to the Samba user database:

    smbpasswd -a tom

Leave a Reply

Your email address will not be published. Required fields are marked *


2 + = three