SAMBA SERVER
WHAT IS SAMBA SERVER?
Samba is used to allow users to share and use files, folders and printers between Linux and Windows systems. In this hashrootz tutorial let us see how to install and configure samba server.
Resource sharing, like file systems and printers, in Microsoft Windows systems, is accomplished using a protocol called the Server Message Block or SMB. For working with such shared resources over a network consisting of Windows systems, an RHEL system must support SMB. The technology used for this is called SAMBA. This provides integration between the Windows and Linux systems. In addition, this is used to provide folder sharing between Linux systems. There are two parts to SAMBA, a Samba Server and a Samba Client.
- What is SMB?
In order to communicate, you and I need a common language, like English or Swahili. Computers are no different. There are a few basic "languages" computers use to communicate on a network, and these languages are called protocols. TCP/IP, NetBEUI, IPX, SNA and Appletalk are examples of protocols. One of the most popular protocols for PCs lets you share files, disks, directories, printers, and (in some cases) even COM ports across a network: this protocol is called the SMB (Server Message Block) standard
My Configurations: Samba server ip:192.168.0.2
windows clint ip:192.168.0.5
SERVER SIDE
- install Samba Packages
- create Samba users
- create Password for samba users
- Edit the Samba configuration file (/etc/samba/smb.conf)
- Restart the services
CLIENT SIDE (WINDOWS)
- Acess Server using run> //192.168.0.4
Configuring the [global] Section
The smb.conf file is divided into sections. The first section is the [global] section where settings can be specified that apply to the entire Samba configuration. Whilst these settings are global, each option may be overridden within other sections of the configuration file.The first task is to define the name of the Windows workgroup on which the RHEL 6 resources are to be shared. This is controlled via the workgroup = directive of the [global] section which by default is configured as follows:
workgroup = MYGROUPBegin by changing this to the actual name of the workgroup . For example, if the workgroup is named WORKGROUP (the default for most Windows networks):
workgroup = workgroup
The next step is to configure a shared resource (in other words a resource that will be accessible from other systems on the Windows network). In order to achieve this, the section is given a name by which it will be referred to when shared. For example, if we plan to share the /tmp directory of our RHEL 6 system, we might entitle the section [tmp]. In this section a variety of configuration options are possible. For the purposes of this example, however, we will simply define the directory that is to be shared, indicate that the directory is browsable and writable and declare the users that are allowed to access the shared resource (in this case a user named demo):
[tmp]
path = /tmp
writeable = yes
browseable = yes
valid users = demo
*path : path of the shared folder
*writable : specify the write access of the client over the shared
resources
>> testparm :used to test the syntax error in configuration fiile
Creating a Samba User
Any user that requires access to a Samba shared resource must be configured as a Samba User and assigned a password. This task is achieved using the smbpasswd command line tool. In our example smb.conf file we stated the user demo is entitled to access the /tmp directory of our RHEL 6 system. In order to fulfill this requirement, therefore, we must add demo as a samba user as follows:# su -
# smbpasswd -a jishnu New SMB password: Retype new SMB password: Added user jishnuNow that we have completed the configuration of a very basic Samba server, it is time to test our configuration file and then start the Samba services.
> TO CHECK SAMBA USERS:
pdbedit -L
> TO DELETE SAMBA USERS
pdbedit -x username
> TO CHANGE SAMBA USER PASSWORD
smbpasswd username
Testing the smb.conf File
The settings in the smb.conf file may be tested using the testparm command line tool as follows:# testparm Load smb config files from /etc/samba/smb.conf rlimit_max: rlimit_max (1024) below minimum Windows limit (16384) Processing section "[homes]" Processing section "[printers]" Processing section "[tmp]" Loaded services file OK. Server role: ROLE_STANDALONE Press enter to see a dump of your service definitions [global] server string = Samba Server Version %v log file = /var/log/samba/log.%m max log size = 50 cups options = raw [homes] comment = Home Directories read only = No browseable = No [printers] comment = All Printers path = /var/spool/samba printable = Yes browseable = No [tmp] path = /tmp valid users = demo read only = No
Now that the Samba resources are configured and the services are running, it is time to access the shared resource from a Windows system. On a suitable Windows system on the same workgroup as the RHEL 6 system, open Windows Explorer and navigate to the Network page. At this point, explorer should search the network and list any systems using the SMB protocol that it finds. The following figure illustrates an RHEL 6 system named SAM1 located using Windows Explorer on a Windows 7 system:
LINUX MACHINE AS AN CLINT OF SAMBA