Sharing Files Between RHEL 5 and Windows Systems with Samba

Follow Techotopia on Twitter Bookmark and Share

From Techotopia

Jump to: navigation, search
PreviousTable of ContentsNext
Using NFS to Share RHEL 5 Folders with Remote Linux and UNIX SystemsConfiguring an RHEL 5 Based Web Server


Purchase and download the full PDF and ePub versions of this RHEL 5 eBook for only $9.99
PDF/ePub edition contains 40 chapters and over 250 pages.
RHEL 6 Edition of this ebook now also available for purchase. Learn more.

Add to Cart


Although Linux is increasingly making inroads into the desktop market, its origins are very much server based. It is not surprising therefore that Red Hat Enterprise Linux 5 has the ability to act as a file server. It is also extremely common for RHEL and Windows systems to be used side by side in networked environments. It is a common requirement, therefore, that files on an RHEL system be accessible to both Linux, UNIX and Windows based systems over network connections. Similarly, shared folders residing on Windows systems must also be accessible from RHEL based systems.

Windows systems share resources such as file systems and printers using a protocol called Server Message Block (SMB). In order for a RHEL system to serve such resources over a network to a Windows system and vice versa it must, therefore, support SMB. This is achieved using technology called Samba. In addition to providing integration between Linux and Windows systems, Samba may also be used to provide folder sharing between Linux systems (as an alternative to NFS which was covered in the previous chapter). In this chapter we will look at the steps necessary to share file system resources and printers on an RHEL system with remote Windows and Linux systems.

Contents




[edit] Samba and Samba Client

Samba allows both RHEL resources to be shared with Windows systems and Windows resources to be shared with RHEL systems. RHEL accesses Windows resources using a package named samba-client. RHEL resources, on the other hand, are shared with Windows systems using a package called samba. Typically, the samba-client is installed and configured by default allowing you to browse available Windows resources without any additional work (this is covered later in the chapter). In order to allow an RHEL system to share resources with Windows systems, however, some more work is required.

[edit] Installing Samba on an RHEL System

The default settings used during the RHEL installation process do not install the samba package. Unless you specifically requested that Samba be installed it is unlikely that you have Samba installed on your system. To check whether Samba is installed, open a terminal window (Applications -> System Tools -> Terminal) and run the following rpm command:

rpm -q samba

If Samba is installed, the rpm command will generate output similar to the following:

samba-3.0.33-3.29.el5

If Samba is not installed, rpm will return with "package samba is not installed". That being the case, it can be installed using the yum command-line tool:

su -
yum install samba

The above command will install both the samba package and the samba-common dependency package. If you prefer to use the graphical tool to perform the Samba installation, select Applications -> Add/Remove Software, enter the root password if prompted to do so and then perform a search for Samba. When the list of matching packages appears, set the checkbox next to the samba and samba-common packages and click on Apply to initiate the installation.

[edit] Starting the Samba Service on RHEL

Having installed the Samba service packages, the next step is to start those services running. This can be done either from the command line, or from the Service Configuration Tool.

To verify that the Samba service is running from the command-line execute following command from a Terminal window:

/sbin/service smb status

If the service is stopped it can be started as follows (note that this command must be performed with super user privileges):

su -
/sbin/service smb start

Alternatively, to configure the Samba service using the GUI based Service Configuration Tool, select it from the System -> Administration -> Services menu. When the tool loads, scroll down the list of services to find smb, select it and click on the Start button. If you want the service to start on reboot make sure that the checkbox next to the entry is selected and click the Save button in the top toolbar. Check the status panel to the right of the dialog to verify the service is running before exiting from the Service Configuration tool.

[edit] Configuring the RHEL Firewall to Enable Samba

Next, the firewall currently protecting the RHEL system needs to be configured to allow Samba traffic. To achieve this, run the Firewall Configuration tool by selecting the System -> Administration -> Security Level and Firewall menu option and select the check box next to Samba in the Trusted Services section of the tool. Click Apply and OK to commit the change.

Before any resources on the RHEL system can be accessed from the Windows systems, however, some additional configuration steps are necessary.

[edit] Configuring Samba Users and Resource Sharing

Once the Samba File sharing is installed and running, the next step is to configure the users that are allowed remote access and also the file system directories (also known as folders) to be shared with the Windows systems. In addition, the RHEL system must be configured to belong to the same workgroup as the Windows systems to which it is to serve files.

The easiest way to achieve this is to use the Samba Server Configuration tool. As with the Samba server packages it is likely that this tool was not installed by default on your RHEL system. To check if it is installed run the following command in a Terminal window:

rpm -q system-config-samba

If the tool is not installed it may be installed as follows:

su - 
yum install system-config-samba

Once installed, the Samba Server Configuration may be launched from the System -> Administration -> Server Settings -> Samba desktop menu option, or from the command-line:

system-config-samba

When loaded, the Samba Server Configuration tool will appear as follows:


The RHEL Samba configuration tool


Select Preferences -> Server Settings... and enter the name of the Windows Workgroup to which you wish this server to belong and click OK. Once this change has been made, the RHEL server should be visible to any Windows systems in the same workgroup. The following figure shows a Red Hat Enterprise Server 5 system named RHEL5 within a Windows 7 Explorer session:


An RHEL system listed in Windows Explorer


Select Preferences -> Samba Users... and select a user from the list which will be used to share folders with the Window's system. After selecting the user, enter the corresponding Windows user name which will be mapped to the RHEL user you just specified and provide a password to be used for share access. Click on OK.

Click on the Add button in the toolbar to add a new folder to share. The following dialog will subsequently appear:


Creating an RHEL 5 Samba resource share


Type or browse to the path you wish to share and enter a share name if you do not like the one provided by the tool. Set the Writable and Visible toggles to your desired settings and click OK. Select the Access tab and either select a user added in the previous step, or allow access to all users.


Configuring user access to shared RHEL resources


Click on OK when you have configured the information in this dialog. The main dialog should appear with the new share listed:


Folders shared on RHEL


Once completed, the folder you specified will be visible from any Windows systems on the same network (and workgroup specified in the Server Settings page) as your RHEL system. You should now have remote access to your Linux folder from the Windows system.

[edit] Accessing Windows Shares from RHEL

As previously mentioned, Samba is a two way street, allowing not only Windows systems to access files and printers hosted on an RHEL system, but also allowing the RHEL system to access shared resources on Windows systems. This is achieved using the samba-client package which is installed by default under most RHEL 5 configurations. If it is not currently installed, install it from a Terminal window as follows:

su –
yum install samba-client 

To access any shared resources on a Windows system, begin by selecting the Places -> Network Servers desktop menu option. This will display the Network browser dialog including an icon for the Windows Network (if one is detected) as illustrated in the following figure:


Accessing a Windows workgroup


To obtain a list of Windows workgroups on the network, double click on the Windows Network icon:


Windows workgroups shown in an RHEL Nautilus window


Similarly, double clicking on a workgroup will list the Windows systems present in the workgroup:


Samba allows the Windows systems on a workgroup to be listed


Finally, double clicking on a computer will list the shared resources available for access from the RHEL client:

Accessing Windows folders from RHEL 5


Purchase and download the full PDF and ePub versions of this RHEL 5 eBook for only $9.99
PDF/ePub edition contains 40 chapters and over 250 pages.
RHEL 6 Edition of this ebook now also available for purchase. Learn more.

Add to Cart



PreviousTable of ContentsNext
Using NFS to Share RHEL 5 Folders with Remote Linux and UNIX SystemsConfiguring an RHEL 5 Based Web Server
Views
Personal tools

Find us on Facebook