Configure Samba shares in CentOS

Jack Wallen
Dec 13, 2010
Updated • Nov 30, 2012

Server OSes, such as CentOS, Red Hat Enterprise Linux, and SUSE Linux Enterprise do not enjoy the same simplicity as does the modern Linux desktop when it comes to issues like sharing out directories (even though they share the same default desktops). You can see how easy it is to share out folders in my article "Easy folder sharing in GNOME".

The server OSes justifiably make this task a bit more challenging to keep administrators from inadvertently sharing out folders that shouldn't be shared or causing security holes to pop up on their servers. But that does not mean the task is fact it's not that much more difficult than it is on their brethren desktop. Let's take a look at how this is done on CentOS.

The tool

Figure 1

Fortunately, there is a GUI tool for just about everything. This too goes for configuring Samba. In the CentOS distribution, the task of administering Samba shares is handled by system-config-samba. This tool is easy to use, but must be run as the root user. If you do not have access to the root user, you will have no luck starting the tool. But with that coveted root user password you can start up the Samba admin tool with the command system-config-samba.

Once the tool has started you will find a very user-friendly GUI (see Figure 1). By default nothing has been shared out...and before you do share anything, you will need to configure Samba. To do this click Preferences > Server Settings. This new window has two tabs:

  • Basic: Configure the name of your workgroup and a description of said workgroup.
  • Security: Configure the security of your Samba server.

NOTE: The more important tab is the security tab. Here  you will configure the authentication mode.

Figure 2

Once you have the server configured click on Preferences > Users. You must add users here before anyone can authenticate (if you select Security = users). Figure 2 shows how users are added. Make sure you select the correct Unix username from the dropdown. After you add that username click OK to be returned to the original window.

You are now ready to connect to your newly added share. You might, however find that you can not connect to that share. If so, the most likely reason is the firewall. Click on System > Administration > Security Level and Firewall. In this window (see Figure 3) you will need to make sure that Samba is checked, but also add ports 137 – 139 and 445.

Figure 3

After you have added all the necessary ports you should be able to connect to that share without a problem. Although you may be tempted to drop your firewall all together (in order to let Samba connections through) it is imperative that you do not simply drop your firewall. Remember, CentOS is a server OS and should be protected.

Final thoughts

It's nice to see that even on the server distributions that Samba has become an incredibly easy system to administer. The system-config-samba tool makes sharing out server directories as easy as if you were on the desktop. Kudos to CentOS, Red Hat, and GNOME!


Previous Post: «
Next Post: «


Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.