How to Install and Configure Samba Server on RHEL 6

Share this Article :

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 :

[[email protected] ~]# 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 :

[[email protected] ~]# service rpcbind start
Starting rpcbind:                                          [  OK  ]
[[email protected] ~]# service xinetd start
Starting xinetd:                                           [  OK  ]

3. Set rpcbind and xinetd start at boot :

[[email protected] ~]# chkconfig rpcbind on
[[email protected] ~]# chkconfig xinetd on

4. Check rpcbind and xinetd service status :

[[email protected] ~]# service rpcbind status
rpcbind (pid  2737) is running...
[[email protected] ~]# service xinetd status
xinetd (pid  2750) is running...

5. Create a normal user named sambauser1 :

[[email protected] ~]# useradd sambauser1
[[email protected] ~]# 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 :

[[email protected] ~]# mkdir /smb
[[email protected] ~]# chmod 777 /smb

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

[[email protected] ~]# 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 :

[[email protected] ~]# 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 :

[[email protected] ~]# chkconfig smb on
[[email protected] ~]# service smb start
Starting SMB services:                                     [  OK  ]

10. Check smb current status :

[[email protected] ~]# service smb status
smbd (pid  2823) is running...

11. Stop iptables and makesure selinux is disabled :

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

12. Check whether samba port opened and running :

[[email protected] ~]# 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

4 Comments

  1. Svssatishkumar2004
  2. Shaana2khan
  3. Mark Wesling
  4. Paran

Leave a Reply