Linux Mint – Sharing files with Samba

Installing Apache On CentOS 8

When sharing files with Linux over your network, there are primarily two main options to pick from. You can choose to share files via Samba or NFS, and both have their own strengths and weaknesses. The decision about which one you use primarily depends on which types of computers you would like to share files with.

With Samba, the network shares you create will be accessible by any Windows computer, as well as any Linux computer that has the Samba client installed. (Most distributions, including Mint, include this by default.) Being able to share files between both Linux and Windows computers may sound like a match made in heaven. However, Samba doesn’t support Linux file and directory permissions without a lot of configuration and planning (which is beyond the scope of this tutorial), to the point that it’s generally not recommended for use if you have specific Linux permissions you would like to maintain, though it is technically possible.

NFS, on the other hand, is only supported by very specific versions of Windows and only if you install the NFS feature in the Windows control panel. Microsoft limits the services for NFS functionality to only the Ultimate and Enterprise versions of Windows 7 and the Professional and Enterprise editions of Windows 8. So, the choice basically comes down to whether or not you are going to be interfacing with Windows machines. If you are, use Samba; if not, use NFS.

Note

As mentioned earlier, firewalls may get in the way when trying to communicate between computers. In the case of Samba, Windows systems also include a software firewall that may block it by default. Before continuing, it may be a good idea to ensure that the system you’re wishing to connect to, allows file sharing.

A complete walk-through of how to configure Samba is beyond the scope of this tutorial, as there is a great deal of configuration options in its configuration file ( /etc/samba/smb.conf), to the point that entire tutorials have been written on the subject. However, there is a very easy way to get started, and that is with the system-config-samba command. By default, this command is not recognized in Mint. To use it, you’ll need to install the associated package using the following command line:


sudo apt-get install system-config-samba

Once it is installed, you can access this handy package with the sudo system-config-samba command or look for the Samba application icon created in your programs menu after installation. The following screenshot shows the Samba Server Configuration window:

Essentially, the
system-config-samba application will edit the /etc/samba/smb.conf file on your behalf. This is much easier for those who have never configured Samba before. For those who are of the inquisitive type, you can see the difference by looking at the /etc/samba/smb.conf file (run the cat /etc/samba/smb.conf command) before and after adding a share with system-config-samba.

To add a new share, click on the
Add Share button at the top-left of corner the system-config-samba window. The Create Samba Share configuration dialog will appear as follows.

There are several fields to fill out in order to share a directory on your network. First, the Directory entry is where you select the path on your filesystem you would like to share. The Share name entry is where you can give the share a name, which is what others will see when browsing network shares on your machine. The Description entry is shown alongside the name when browsing shares, depending on the file manager that is being used to list your available shares. The two checkboxes at the bottom allow you to choose whether or not others can make changes to the files contained in that directory, and whether or not the share is visible to others.

Note

Including an option to essentially make a share hidden may seem contradictory to the idea of sharing files. However, situations may arise where you may want to make your files accessible to others, but you may not necessarily want to broadcast the share. To access such a hidden share, you would have to know the network path and type it in manually on the other machine.

Finally, on the Access tab, you can select whether to grant access to specific users or everyone. After adding the share, you should see it on other machines by browsing the list of available network places. If the share doesn’t show up, you may need to restart the samba service by executing the following command:


sudo service samba restart

Comments are closed.