Sharing Folders over a Network Using SAMBA

This is a guide written for Fedora Linux, but it MIGHT be useful for other RPM based distributions as well. If you follow this guide successfully, you will be able to drag and drop files from and to Linux shared folders, access any file or folder on the Linux server.

SAMBA is a suite of applications for unix-like operating systems that provide seamless integration between UNIX and Windows machines. It can be configured to register itself with the master browser on the network in order to be listed among the hosts in WIN9x/NT’s “Network Neighborhood”.

Before we proceed, you must ensure that SAMBA is installed on your server. The command:

# rpm -qa | grep samba

should print “samba, samba-common, samba-client and system-config-samba”. If there isn’t any response to that command, simply run as root:

# yum install samba

Firewall and SELinux Settings

Your system security has to be configured in order for SAMBA to work properly. Go to a root terminal and type:

# system-config-securitylevel

From the Firewall Options tab, check the box near Samba to make it a trusted service. Next, go to SELinux tab, look for Samba in the SELinux Policy drop-down list and check all the boxes for Samba. Press OK to close the window. Finally, open /etc/sysconfig/iptables in a text editor and add the following lines just before the -j REJECT line:

-A RH-Firewall-1-INPUT -p udp -m udp -s –dport 137 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp -s –dport 138 -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp -s –dport 139 -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp -s –dport 445 -j ACCEPT

Save the file and then, open a root terminal and type:

# /etc/init.d/iptables restart

Those iptables config lines are compatible with the Fedora Core firewall, if you use other distributions; simply edit them accordingly, in order to match your distribution’s firewall configuration.

Enabling SAMBA Services

By default, the SMB daemon is not started at boot time, so you’ll have to do it yourself. Open a terminal and, as root, type the commands:

# chkconfig smb on
# /etc/init.d/smb restart

Create Linux Users and Directories

For SAMBA server to function correctly, you must add users to both Linux server and SAMBA server. To add users to the Linux server, open a terminal and, as root, type the command:

# system-config-users

Here, add all the users you want to access the SAMBA shares, as well as their passwords and share directories.

SAMBA Server Configuration

In this section, you will configure SAMBA server to allow certain users to access the server from LAN PCs. From a root terminal, type:


This step will alter the SAMBA configuration file (/etc/samba/smb.conf) so it’s a good idea to back it up in case you encounter troubles.

Go to Preferences > Server Settings. Be sure to include the same workgroup name used by Windows PCs. In the same window, go to Security tab. Settings in this tab are, by default, the appropriate ones so you won’t have to change anything. Just be sure the authentication mode is set to User. Click OK to close it.

Next, go to Preferences > Samba Users. In this window you must add at least one user who will have access to the SAMBA Server. Click on Add User, choose the user created a few steps back, write its windows username, set a password and click OK.

If you only want to set a Public Shared Folder, first go to Proprieties > Server Settings > Security and choose “Share” for the “Authentication Mode”. Then, add a new share for the directory /tmp, write in the Share Name and Description something like “Public Folder”, check both “Writable” and “Visible” boxes and from the “Access” tab, select “Allow access to everyone”. This way, anyone accessing the server share, will be able to read and write to the public folder (/tmp on Linux server) without being asked for any username or password, allowing users to easily exchange files.

Adding a shared folder. Here, you have to set the shared folder for every user created a few steps back. It’s recommended you use each user’s home directory in order to avoid any permission errors. For instance, if you created the user “tom”, you should create a share with the directory “/home/tom”. And then, repeat this step for every user created. Next, fill the share name and description and check the Writable and Visible boxes. (optional). Further on, go to Access tab and select each user created earlier. So again, if you selected “/home/tom” as the shared directory, you must select the user “tom” from this list. Repeat this step for every share.

Restart SAMBA

For the settings to apply, the SAMBA server has to be restarted. In order to do this, open a root terminal window and execute the following command:

# /etc/init.d/smb restart

If no errors were present and the restart was successful, it’s time to connect to the SAMBA Server.

Access the SAMBA Shares from Linux PCs

Open a Konqueror window and type in the address bar:


This is an example IP, you will have to enter you server IP there, but keeping the syntax. The shared folders for each user will appear. When you’ll try to enter a shared directory, a login window will pop up, asking for username and password. To access the shared folder, you will have to enter the login information you used when creating the samba user. From there on, everything is pretty straightforward.

Review image Review image

From : Softpedia


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s