Professional Documents
Culture Documents
Samba allows both CentOS resources to be shared with Windows systems and Windows resources to be shared with CentOS systems. CentOS accesses Windows resources using a package named samba-client. CentOS resources, on the other hand, are shared with Windows systems using a package named samba. Typically, the samba-client is installed and configured by default allowing the user to browse available Windows resources without any additional work (this is covered later in the chapter). In order to allow a CentOS 6 system to share resources with Windows systems, however, some more work is required.
In releases of CentOS prior to version 6, a user friendly graphical tool named system-config-samba was provided to assist in the configuration of Samba. In CentOS 6, however, this tool has been removed. This means that the Samba environment must be configured manually within the /etc/samba/smb.conf file and using the smbpasswd command line tool. Whilst the loss of systemconfig-samba may be mourned by those who relied on it, the tools simplicity actually masked many of the more advanced features of Samba. In practice, much more can be achieved by taking the time to understand the intricacies of the smb.conf file. Samba is a highly flexible and configurable system that provides many different options for controlling how resources are shared on Windows networks. This flexibility can lead to the sense that Samba is overly complex to work with. In reality, however, many of the configuration options are not needed by the typical installation, and the learning curve to set up a basic configuration is actually quite short. For the purposes of this chapter we will look at joining a CentOS 6 system to a Windows workgroup and setting up a directory as a shared resource that can be accessed by a specific user. The first step, therefore, is to gain root privileges and to load the /etc/samba/smb.conf file into a suitable editor, for example: su gedit /etc/samba/smb.conf
workgroup = MYGROUP Begin 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
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
/sbin/service smb restart /sbin/service nmb restart If, on the other hand, the services are currently stopped, start them as follows: /sbin/service smb start /sbin/service nmb start
Double clicking on the CentOS 6 host will prompt for the name and password of a user with access privileges. In this case it is the demo account that we configured using the smbpasswd tool. Entering the username and password will result in the shared resources configured for that user appearing the explorer window, including the tmp resource previously configured:
Double clicking on the tmp shared resource will display a listing of the files and directories contained therein.
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 servers available for access: