CentOS 5.6 Samba Standalone Server With tdbsam Backend*** may used in Centos 6.0 ***Version 1.0Author: Falko Timme <ft [at] falkotimme [dot] com>Follow me on TwitterLast edited 04/26/2011This tutorial explains the installation of a Samba fileserver on CentOS 5.6 and how to configure it toshare files over the SMB protocol as well as how to add users. Samba is configured as a standaloneserver, not as a domain controller. In the resulting setup, every user has his own home directoryaccessible via the SMB protocol and all users have a shared directory with read-/write access.I do not issue any guarantee that this will work for you!1 Preliminary NoteIm using a CentOS 5.6 system here with the hostname server1.example.com and the IP address192.168.0.100.Please make sure that SELinux is disabled and firewall.Disable SELinux[root@host2a ~]# cat /etc/sysconfig/selinux# 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 - SELinux is fully disabled.SELINUX= disabled# SELINUXTYPE= type of policy in use. Possible values are:# targeted - Only targeted network daemons are protected.# strict - Full SELinux protection.SELINUXTYPE=targetedDisable FirewallSetup > firewall > disable firewall.
2 Installing SambaCheck samba install or not. By default not install.rpm -q sambaConnect to your server on the shell and install the Samba packages:Server:yum install samba samba-commonSamba clientyum install samba-clientTime to configure samba server.I highly recommend backing up your smb.conf file before using Samba. You can do this by issuing thefollowing command from the directory where your smb.conf file is located:cd /etc/sambacp smb.conf smb.conf.originalEdit the smb.conf file:vi /etc/samba/smb.confMake sure you 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 enables Linux system users to log in to the Samba server.Then create the system startup links for Samba and start it:chkconfig --levels 235 smb on/etc/init.d/smb start
3 Adding Samba SharesNow I will add a share that is accessible by all users.Create the directory for sharing the files and change the group to the users group:mkdir -p /home/shares/alluserschown -R root:users /home/shares/allusers/chmod -R ug+rwx,o+rx-w /home/shares/allusers/At the end of the file /etc/samba/smb.conf add the following lines: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 = yesIf you want all users to be able to read and write to their home directories via Samba, add the followinglines to /etc/samba/smb.conf (make sure you comment out or remove the other [homes] section in thesmb.conf file!):[homes] comment = Home Directories browseable = no valid users = %S writable = yes create mask = 0700 directory mask = 0700Now we restart Samba:/etc/init.d/smb restart
4 Adding And Managing UsersIn this example, I will add a user named tom. You can add as many users as you need in the same way,just replace the username tom with the desired username in the commands.useradd tom -m -G usersSet a password for tom in the Linux system user database. If the user tom should not be able to loginto the Linux system, skip this step.passwd tom-> Enter the password for the new user.Now add the user to the Samba user database:smbpasswd -a tom-> Enter the password for the new user.Now you should be able to log in from your Windows workstation with the file explorer (addressis 192.168.0.100 or 192.168.0.100tom for toms home directory) using the username tom and thechosen password and store files on the Linux server either in toms home directory or in the publicshared directory.5 Links Samba: http://www.samba.org/ CentOS: http://www.centos.org/CentOS 5.6 Samba Standalone Server With tdbsam BackendSubmitted by falko (Contact Author) (Forums) on Fri, 2011-07-08 13:57. :: CentOS | Samba | Storage
Additional noteStarting the Samba and NetBIOS Name Services on RHEL 6In order for an RHEL 6 server to operate within a Windows network both the Samba (SMB) andNetBOIS nameservice (NMB) services must be started. To identify if the services are already running,the following command may be executed with root privileges in a terminal window:su –/sbin/service smb statussmbd is stopped# /sbin/service nmb statusnmbd is stoppedIf the services are reported as currently running and you have made changes to the smb.conf file it willbe necessary to restart the services in order to pick up the changes:/sbin/service smb restart/sbin/service nmb restartIf, on the other hand, the services are currently stopped, start them as follows:/sbin/service smb start/sbin/service nmb startAccessing Samba SharesNow that the Samba resources are configured and the services are running, it is time to access theshared resource from a Windows system. On a suitable Windows system on the same workgroup as theRHEL 6 system, open Windows Explorer and navigate to the Network page. At this point, explorershould search the network and list any systems using the SMB protocol that it finds. The followingfigure illustrates an RHEL 6 system named rhel6 located using Windows Explorer on a Windows 7system:
Double clicking on the RHEL 6 host will prompt for the name and password of a user with accessprivileges. In this case it is the demo account that we configured using the smbpasswd tool. Enteringthe username and password will result in the shared resources configured for that user appearing theexplorer window, including the tmp resource previously configured:
Double clicking on the tmp shred resource will display a listing of the files and directories containedtherein.Accessing Windows Shares from RHEL 6As previously mentioned, Samba is a two way street, allowing not only Windows systems to accessfiles and printers hosted on an RHEL 6 system, but also allowing the RHEL system to access sharedresources on Windows systems. This is achieved using the samba-client package which is installed bydefault under most RHEL 6 configurations. If it is not currently installed, install it from a Terminalwindow as follows:su –yum install samba-clientTo access any shared resources on a Windows system, begin by selecting the Places -> Networkdesktop menu option. This will display the Network browser dialog including an icon for the WindowsNetwork (if one is detected) as illustrated in the following figure:To obtain a list of Windows workgroups on the network, double click on the Windows Network icon.From within the list of workgroups double click on the desired group to obtain a listing of serversavailable for access:
Finally, double clicking on a computer will list the shared resources available for access from theRHEL client.Fromhttp://www.techotopia.com/index.php/Sharing_Files_between_RHEL_6_and_Windows_Systems_with_Samba
Managing samba using webminIn centos 5.6 there is GUI : system-config-samba but in centos 6 not have any GUI to manage samba.Management tool using web browser is call webmin.Let install and using it.Download latest rpm for centos form webminwget http://www.webmin.com/download.htmlinstall using commandrpm -Uvh webmin.x.x.x.rpmwait until finish installationsopen web browser and point your web browser to samba server port 10000http://no.ip.sambaserver:10000login with root acount and password.