How to Install and Configure Samba Server on RHEL 6

In this post i will show on how to install and configure a Samba server an also how to transfer files from client side. For this example we are using two systems one Red Hat Enterprise Linux (RHEL 6) server one Window XP clients.

1. Install samba, portmap or rpcbind and xinetd service :

[root@rhel6 ~]# yum install samba-* portmap xinetd -y
Loaded plugins: rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package rpcbind.i686 0:0.2.0-8.el6 set to be updated
---> Package samba.i686 0:3.5.4-68.el6 set to be updated
---> Package samba-client.i686 0:3.5.4-68.el6 set to be updated
---> Package samba-common.i686 0:3.5.4-68.el6 set to be updated
---> Package samba-winbind.i686 0:3.5.4-68.el6 set to be updated
---> Package samba-winbind-clients.i686 0:3.5.4-68.el6 set to be updated
---> Package xinetd.i686 2:2.3.14-29.el6 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================
 Package                      Arch        Version                 Repository                   Size
====================================================================================================
Installing:
 rpcbind                      i686        0.2.0-8.el6             DVD-RHEL6-Repository         50 k
 samba                        i686        3.5.4-68.el6            DVD-RHEL6-Repository        5.0 M
 samba-client                 i686        3.5.4-68.el6            DVD-RHEL6-Repository         11 M
 samba-common                 i686        3.5.4-68.el6            DVD-RHEL6-Repository         13 M
 samba-winbind                i686        3.5.4-68.el6            DVD-RHEL6-Repository        3.5 M
 samba-winbind-clients        i686        3.5.4-68.el6            DVD-RHEL6-Repository        1.1 M
 xinetd                       i686        2:2.3.14-29.el6         DVD-RHEL6-Repository        121 k

Transaction Summary
====================================================================================================
Install       7 Package(s)
Upgrade       0 Package(s)

Total download size: 34 M
Installed size: 121 M
Downloading Packages:
----------------------------------------------------------------------------------------------------
Total                                                                42 MB/s |  34 MB     00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : samba-winbind-clients-3.5.4-68.el6.i686                                      1/7
  Installing     : samba-common-3.5.4-68.el6.i686                                               2/7
  Installing     : samba-3.5.4-68.el6.i686                                                      3/7
  Installing     : samba-client-3.5.4-68.el6.i686                                               4/7
  Installing     : samba-winbind-3.5.4-68.el6.i686                                              5/7
  Installing     : 2:xinetd-2.3.14-29.el6.i686                                                  6/7
  Installing     : rpcbind-0.2.0-8.el6.i686                                                     7/7

Installed:
  rpcbind.i686 0:0.2.0-8.el6                   samba.i686 0:3.5.4-68.el6
  samba-client.i686 0:3.5.4-68.el6             samba-common.i686 0:3.5.4-68.el6
  samba-winbind.i686 0:3.5.4-68.el6            samba-winbind-clients.i686 0:3.5.4-68.el6
  xinetd.i686 2:2.3.14-29.el6

Complete!

2. On RHEL 6, portmap is called and replaced by rpcbind. Make sure rpcbind and xinetd is start :

[root@rhel6 ~]# service rpcbind start
Starting rpcbind:                                          [  OK  ]
[root@rhel6 ~]# service xinetd start
Starting xinetd:                                           [  OK  ]

3. Set rpcbind and xinetd start at boot :

[root@rhel6 ~]# chkconfig rpcbind on
[root@rhel6 ~]# chkconfig xinetd on

4. Check rpcbind and xinetd service status :

[root@rhel6 ~]# service rpcbind status
rpcbind (pid  2737) is running...
[root@rhel6 ~]# service xinetd status
xinetd (pid  2750) is running...

5. Create a normal user named sambauser1 :

[root@rhel6 ~]# useradd sambauser1
[root@rhel6 ~]# passwd sambauser1
Changing password for user sambauser1.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

6. Create /smb directory and grant it full permission :

[root@rhel6 ~]# mkdir /smb
[root@rhel6 ~]# chmod 777 /smb

7. Open and modify /etc/samba/smb.conf main samba configuration files :

[root@rhel6 ~]# vi /etc/samba/smb.conf
#
# Hosts Allow/Hosts Deny lets you restrict who can connect, and you can
# specifiy it as a per share option as well
#
        workgroup = MSHOME
        server string = Samba Server Version %v

;       netbios name = MYSERVER

;       interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24
        hosts allow = 127. 192.168.12. 192.168.13. 192.168.1.
# Add this line to share at the bottom of the config file :
[smb]
comment = Personal stuff
path = /smb
public = no
writable = yes
printable = no
browseable = yes
write list = sambauser1

8. Now add sambauser1 user to samba user :

[root@rhel6 ~]# smbpasswd -a sambauser1
New SMB password:
Retype new SMB password:
tdbsam_open: Converting version 0.0 database to version 4.0.
tdbsam_convert_backup: updated /var/lib/samba/private/passdb.tdb file.
account_policy_get: tdb_fetch_uint32 failed for type 1 (min password length), returning 0
account_policy_get: tdb_fetch_uint32 failed for type 2 (password history), returning 0
account_policy_get: tdb_fetch_uint32 failed for type 3 (user must logon to change password), returning 0
account_policy_get: tdb_fetch_uint32 failed for type 4 (maximum password age), returning 0
account_policy_get: tdb_fetch_uint32 failed for type 5 (minimum password age), returning 0
account_policy_get: tdb_fetch_uint32 failed for type 6 (lockout duration), returning 0
account_policy_get: tdb_fetch_uint32 failed for type 7 (reset count minutes), returning 0
account_policy_get: tdb_fetch_uint32 failed for type 8 (bad lockout attempt), returning 0
account_policy_get: tdb_fetch_uint32 failed for type 9 (disconnect time), returning 0
account_policy_get: tdb_fetch_uint32 failed for type 10 (refuse machine password change), returning 0
Added user sambauser1.

9. Set smb service auto start at boot :

[root@rhel6 ~]# chkconfig smb on
[root@rhel6 ~]# service smb start
Starting SMB services:                                     [  OK  ]

10. Check smb current status :

[root@rhel6 ~]# service smb status
smbd (pid  2823) is running...

11. Stop iptables and makesure selinux is disabled :

[root@rhel6 ~]# service ip6tables stop
ip6tables: Flushing firewall rules:                        [  OK  ]
ip6tables: Setting chains to policy ACCEPT: filter         [  OK  ]
ip6tables: Unloading modules:                              [  OK  ]
[root@rhel6 ~]# service iptables stop
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]
[root@rhel6 ~]# setenforce 0
setenforce: SELinux is disabled

12. Check whether samba port opened and running :

[root@rhel6 ~]# netstat -plunt | grep smbd
tcp        0      0 :::139                      :::*                        LISTEN      3212/smbd
tcp        0      0 :::445                      :::*                        LISTEN      3212/smbd

13. Go on windows system and ping samba server. Make sure workgroup = MSHOME and allow 192.168.1.x network.
samba
14. Enter share path.
samba
15. First try to login from sambauser1 account :
samba
16. Samba successfully connected. You can start to upload now :
samba

How to Reset the Directory Manager Password on RHEL 7 / CentOS 7
How to Reset the Directory Manager Password on RHEL 7 / CentOS 7

It is best practice to remember passwords, but because too many passwords, sometimes we forget. We are not encouraged to write the password on any paper or share the password...

How to Find Big Files Size on Linux RHEL/CentOS
How to Find Big Files Size on Linux RHEL/CentOS

As the linux administrator, sometimes we have to identify which files are most take much space in the linux server resulting in low free space. Low disk space can also...

Why Linux users should worry about malware and what they can do about it
Why Linux users should worry about malware and what they can do about it

Don’t drop your guard just because you’re running Linux. Preventing the spread of malware and/or dealing with the consequences of infection are a fact of life when using computers. If...

How to Reset Forgotten Root Password on Linux RHEL 7 / CentOS 7
How to Reset Forgotten Root Password on Linux RHEL 7 / CentOS 7

This short howto will explain the steps to reset a lost root password or to reset a forgotten root password on Linux RHEL 7 or CentOS 7. Basically, we will...

How to Update CentOS or Upgrade CentOS to the Latest Version
How to Update CentOS or Upgrade CentOS to the Latest Version

Recently, the latest version of CentOS 7.3 was released. All users of CentOS 7.0, 7.1 and 7.2 can upgrade their system to the most recent. This quick guide will explain...

How to Change your WordPress Username, Nickname and Display Name in MySQL
How to Change your WordPress Username, Nickname and Display Name in MySQL

After you create an account log in WordPress, you may want to change your WordPress username, as appropriate or due to security reason. However, you can not do this from...

How to Enable SSH Root Login on Ubuntu 16.04
How to Enable SSH Root Login on Ubuntu 16.04

As what we wrote in the previous article on how to allow SSH root on Ubuntu 14.04, after installing a fresh new copy of Ubuntu 16.04 LTS, we find that...

How to Change UUID of Linux Partition on CentOS 7
How to Change UUID of Linux Partition on CentOS 7

UUID (Universally Unique IDentifier) should be unique and it is used to identify storage devices on a linux system. If you cloned a virtual machine from vCenter, the metadata containing...

4 Comments

  • Avatar for Svssatishkumar2004 Svssatishkumar2004 says:

    Really Nice post — Satish Kumar Sadhu

  • Avatar for Shaana2khan Shaana2khan says:

    Thanks for help,it’s working fine…

  • Avatar for Mark Wesling Mark Wesling says:

    I can map a drive to linux share but when I try to open the share on my PC I get the following message:
    “Z:refers to a location that is unavailable.”  I doesn’t semm to matter how smb.conf is configured.  I can lookup/reverse lookup the DNS name.

    encrypt passwords = yesworkgroup = uch.ad.pvt
    security = sharepassdb backend = tdbsamguest account = nobody

    [chsdev]
    path = /data/chsdev        public = yes        writable = yes        printable = yes        browseable = yes        guest only = yes        guest ok = yes        force user = nobody

  • Avatar for Paran Paran says:

    Thanks of lot. Successfully done without any hazard.

Leave a Reply

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