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.
14. Enter share path.
15. First try to login from sambauser1 account :
16. Samba successfully connected. You can start to upload now :
4 Comments
Really Nice post — Satish Kumar Sadhu
Thanks for help,it’s working fine…
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
Thanks of lot. Successfully done without any hazard.