Samba and Suse / openSUSE: HowTo Make Simple on-the-fly Samba Shares with Konqueror, Dolphin or Nautilus

Versions: Suse / openSUSE 10.x, 11.x


Sharing directories in Windows has long been fairly easy, a few clicks and it's done. The same "on-the-fly" facilities exist in Linux for Gnome using Nautilus and also for KDE using either Konqueror or Dolphin. This facility is on by default in the early Windos distros. In Linux you have to consciously turn on the ability to share directories on-the-fly.

Shares made in Nautilus are so-called "usershares", a new functionality that was introduced in openSUSE 10.2. Shares made in Konqueror/Dolphin are the normal, classical type. As I describe them here, both Linux types are deliberately insecure in the style of standard Windows shares, available to all network users. It's wise to be aware of this limitation. If you need more sophisticated shares you can read these two allied tutorials: A Suse/openSUSE/Windows Network Primer and/or HowTo Configure a Professional File Server.

This tutorial divides into the following parts:

↑↑↑↑ Setting up Gnome for on-the-fly sharing in Nautilus

You need to install Usershare functionality. The task varies with your version of Suse and which media you used to install it. I'll cover three possible areas even though some of them might already be in place for you.

Software RPMs: Check and if necessary install RPMs samba, samba-client and nautilus-share.

Samba's configuration file: smb.conf is a text file located at /etc/samba/smb.conf. It's made up of a number of stanzas which commence with headings in square brackets: e.g. [heading]. In particular the stanza headed [global] must contain the following three lines:

usershare allow guests = Yes
usershare max shares = 100
usershare owner only = False

If you need to make changes you'll need a text editor with superuser powers. In gnome you can open it with this command in a console:

gnomesu gedit /etc/samba/smb.conf

or if you're doing this in KDE use this command:

kdesu kwrite /etc/samba/smb.conf

Check whether all three are there and if any are missing simply type the missing one/s in anywhere in the [global] stanza (the topmost stanza). Don't forget to make a backup of smb.conf before you edit it.

The storage directory: Configurations for the usershares you create are stored in directory usershares located at /var/lib/samba/usershares. You can list it in a console window with command ls -l /var/lib/samba and expect the following dialogue amongst the replies:

john@suse111:~> ls -l /var/lib/samba
drwxrwx--T 2 root users   &npsp; 4096 2008-12-20 22:04 usershares

It's most likely there, but if it's missing, create it with these console commands and then check again:

sudo mkdir /var/lib/samba/usershares
sudo chgrp users /var/lib/samba/usershares
sudo chmod 1770 /var/lib/samba/usershares

That's all for the configuration. Now you can make the shares.

↑↑↑↑ Making shares in Nautilus

Nautilus has a right-click GUI that allows on-the-fly sharing of a folder as a usershare. [If you receive error messages regarding usershares or regarding a missing directory while creating a share, you may not have set up prerequisites properly. See previous section.] Simply R-click on your selected folder while viewing it in Nautilus file manager, select "Sharing options" and enable the share as on the following pics:

IMAGE Not Available ERROR

The pictures speak for themselves. You don't have to change the default permissions/access controls on the folder sharefolder for the read-write case as you do for a classical share using Konqueror. Usershares have their access controls set in the share configuration file that is written in /var/lib/samba/usershare.

FYI, here is the config file for a read-only usershare:

#VERSION 2
path=/home/username/sharefolder
comment=
usershare_acl=S-1-1-0:R
guest_ok=y

FYI, here is the config file for a read-write usershare:

#VERSION 2
path=/home/username/sharefolder
comment=
usershare_acl=S-1-1-0:F
guest_ok=y

They differ by only one letter. The files are located at /var/lib/samba/usershares

↑↑↑↑ Setting up KDE for on-the-fly sharing in Dolphin/Konqueror

The following method has been tested in all the 10.x series and 11.0, 11.1, 11.2 beta

Software: check that you have installed the RPMs samba, samba-client and fileshareset. This console command will check for you: rpm -qa | egrep "samba|fileshareset".

KDE in openSUSE has a bug: The setup scripts are supposed to enable making shares without root privileges. Sometimes when you finish the setup for Dolphin or Konqueror, you'll receive an error like this: "An error occurred whilst trying to share folder '/path_to/directory'. Make sure that the Perl script 'fileshareset' is set suid root."; there's a screenshot of the error on this link. Other times the setup refuses to complete. Other times the setup seems to work but you still make shares without root privileges. The reason is that KDE has a bug and you must proceed with the configuration exactly in sequence as I lay it out below if you want to skirt around the bug.

Initialise the configuration file: The filesharing parameters are contained in file fileshare.conf stored at /etc/security/fileshare.conf. You can check/view the current contents of the file with this console command:

cat /etc/security/fileshare.conf

Here are the default contents laid down during the installation of openSUSE:

RESTRICT=yes

If the file is not in the default state you must change it to the default before you proceed with the GUI configuration. To restore the file, open a console and enter su to become root; then enter this command:

echo RESTRICT=yes > /etc/security/fileshare.conf

The configuration: Now you proceed to the GUI part of the configuration. Browse to any directory in your home territory, under /home/your_username/ and R-click --> select Properties -- select Share. The panel in Pic A will open.

PNG ERROR - missing screenshot

If you do not see the panel on the left, you have not properly initialised the file /etc/security/fileshare.conf and you must go back to initialise it so it contains only the line RESTRICT=yes.

When the panel appears correctly, click Configure File Sharing and after authentication, the main panel as in Pic B will open. (see next)

PNG ERROR - missing screenshot

Move the selection dot from Simple sharing to Advanced sharing.

Tick to enable Use Samba and optionally Use NFS.

Then click the button Allowed Users and the next panel, Pic C will open.

PNG ERROR - missing screenshot PNG ERROR - missing screenshot

In Pic C, make sure the dot is against "Only users of a certain group are allowed to share folders" and click Choose Group. Pic D will open. Use the drop-down selector beside New file share group to locate and select the group users. Then click OK and the panel in Pic E will open.

PNG error - missing png

Make sure you select/tick the option "Group members can share folders without root password". Then click OK and you will be taken back to the main panel as in Pic B.

Important: when Pic B opens again, immediately click the button Allowed Users again.

Pic E will reopen. Continued below.........

Shift the dot from beside "Only users of a certain group are allowed to share folders" and place it beside "Allow all users to share folders". Be sure not to disturb the tick in the box for "Group members can share folders without root password".

By now the panel should appear as in the left screenshot, Pic F.

Click OK and you will return to the main panel, Pic B.

In Pic B click the button on lower right to Apply and save your settings. Then click OK to close.

You will be presented with the panel to the left, Pic G. There you alter nothing; just click OK to exit.

At this stage you have finished setting up KDE for file sharing and can proceed to share folders.

If something went wrong, simply return to the first step, reinitialise the file fileshare.conf and do follow through the steps again.

↑↑↑↑ Making shares in Dolphin or Konqueror

PNG image here

First a few ground rules.

The directory Desktop has restricted permissions drwx------, "forbidden" to everyone except the owner. Consequently you can't make these simple Samba shares in/on the Desktop. You make them anywhere else in your home territory under /home/your_username.

Next, the GUI configurator in Dolphin/Konqueror has the tools to make very complex shares but that is for experts. Most experts prefer to use the command line and text editors to make advanced shares. To make simple, on-the-fly shares, stay away from the button labelled More Samba options in the screenshot to the left. If you do go there and the share doesn't work, simply use the configurator to remove it and start again.

To make a share, browse to it in Dolphin or Konqueror and R-click --> select tab labelled Share. Tick Share with Samba and Public. The default Name is inserted for you as a capitalised version of name of the folder you chose. That Name is how it is viewed on the network. You may change it to anything sensible.

Read-only and read-write: If you leave the option Writable unticked, the share will be read-only. To make it read-write you do two things: First, you tick the Writable option. Second, you must change the linux permissions on the shared folder. To change the permissions to make your simple share writeable, select the tab labelled permissions. Use the drop-down selectors to set Can View and Modify Content for the permissions on each of Owner, Group and Others.

Click the OK button to finish.

FYI: The KDE-Dolphin/Konqueror facility creates a "classical" share that writes its configuration to a paragraph in the Samba config file at /etc/samba/smb.conf. The entry in smb.conf for the read-only share in the screenshot is:

[ASHARE]
path = /home/username/ashare
guest ok = yes

The entry in smb.conf for the read-write version is:

[ASHARE]
path = /home/username/ashare
guest ok = yes
read only = no

Take it easy.

Swerdna: 28 February 2007. Last update: 28 January 2009.