HOWTO Make Folder (File) Sharing Work Under Rebecca

MagicMint
  8 years ago
  3

The motivation

Although called ‘Preferences› Personal File Sharing’ in cinnamon’s menu, it is the folder sharing known from Windows which is meant, and which is correctly spelled in the context menu of any shareable folder in nemo. This functionality is offered by a package named samba which is normally installed by Linux Mint (if not, re-install it via the Software Manager).

As you can easily guess it, this is a Windows protocol, and as such, notoriously difficult to configure. Hence, it’s no wonder that in LM 17.1 Rebecca something went wrong on the way from Debian over Ubuntu to Linux Mint, and some trifles are missing for folder sharing to be fully functional out of the box.

Simply put, the fields of the following dialog didn’t work for me on a fresh install of Rebecca:

Folder Sharing Dialog
 

Some missing details

In order to be able to create any share, the folder where it will be created must belong to the group sambashare, so type the following commands in a terminal:

   …$ sudo chown root:sambashare /var/lib/samba/usershares/
   …$ sudo service samba restart

Your user must be a member of that group too, of course. This is usually the case for the user you’ve created during the installation of Linux Mint. You can verify this easily in cinnamon’s settings or its Menu› Preferences› under ‘Users and Groups’. If sambashares is not listed under Groups for the user in question, add it (it is available merely for administrator accounts by default).

Provided you didn’t touch the default samba configuration otherwise, this alone will allow you to share your folders with any user on your machine in possession of a valid password. You can check this straightaway by sharing a folder and looking for it under Network in nemo’s panel. You should be able to ‘login’ to the shared folder with your own password.

In this case you’ve simulated a view from the outside onto your computer — in other words, this is the other side of file sharing, i.e. when you’re looking at other machines which act as file servers. Unfortunately, due to the imponderables of server name resolution in (Windows) networks, this side, the browsing side does hardly ever work reliably and in some circumstances, you won’t see the share you want to connect to surprise. In such a case, you should alway provide the IP address of the target server instead of its name (this holds for both the location entry field in nemo and the ‘Connect to Server …’ dialog). For the local test above, the direct address reads:

   smb://127.0.0.1/

But you should arguably not distribute your password to people you want to share files with. If you want to avoid this, you should activate guest access (the last option in the dialog). But this option is only available when your system has an appropriate dummy user who doesn’t need a password (actually, any password will do, if a login should become necessary because the server isn’t visible in the file manager). So create that special user with:

   …$ sudo useradd -g nobody -d /dev/null -s /bin/false -c "Samba guest account" smbguest

Caution

The tricks above refer to the default, vanilla configuration of samba by Linux Mint. This is the easiest way to get it working, really! Do not even try graphical configuration tools of the likes of gadmin-samba or system-config-samba — unless you know what you’re doing — as they will inevitably mess up angry the basic Debian–Ubuntu–LM samba settings on your system which are secure enough and should work as easily as in Windows.

Additional clues

  • As remarked by @jupiter66 in his first comment below, the only thing you’ll need from Linux Mint 17.2 Rafaela on is to add a Samba user explicitly, if you want your shares to be password protected:
      …$ sudo smbpasswd -a user’s_name_for_Samba
  • In order to avoid the mess of having to address a remote server properly, make use of Linux Mint’s built-in Avahi server, even though it needs some minimal configuration additionally.
Comments
robknol 8 years ago

I can't get it to work, first I tried the Nemo option. Than with the samba graphical user interface. I can see the other computer on my network an the shared files but not the other way around.l from the other computer ( also mint linux ) i cannot see computer 1.
Restarted and so and make myself member of the samba group.
I now run upstairs with a good old usb stick.


Rebel450 8 years ago

Of course.
And - still it is very true that you have to know what you are doing,
even with a graphical interface.
In any case you should have basically knowledge and not to play try and error inside the user and groups.
If in doubt - reading is your friend ;-)


MagicMint 8 years ago

@Rebel450: I do agree — with regard to your last line more than everything else… I just think that fiddling around with those configurations can easily leave the door wide open, which a guest account doesn’t do since it’s read only by default. As we’re talking about sharing contents rather than hiding them, it isn’t that a big sin in my eyes ;-)


Rebel450 8 years ago

I dont have problems with system-config-samba -
I can adjust my server settings as per my gusto;
dont need to get a diploma for configuring Samba via bash...
Guest access to MY files/OS ?! oh nooooo!
Btw: for samba on win = it is the worse ever.


MagicMint 8 years ago

@Rebel450: Samba is installed by default AFAIK. As far as system-config-samba is concerned, see the remark at the end of the tutorial.


Rebel450 8 years ago

ahm...

since you are talking about Rafaela, go to:

System Preferences/user and groups/select the user meant/click on groups/
add sambashare
(by default already established)
this user can always login with his system login/pass as soon one folder
is defined as shared.

or just install Samba via the software manager - for making life easy:
system-config-samba

enjoy


MagicMint 8 years ago

@jupiter66: I don’t know if it’s Samba’s fault or Nemo’s. The only difference between the two admins here is that the one who’s permitted to login is member of the fuse group additionally.


jupiter66 8 years ago

@MagicMint: Strange, since my user ID is 1000... Maybe 17.2 fixed this?


MagicMint 8 years ago

@jupiter66: It’s more nuanced than that. The standard Mint user with ID=1000 cannot login indeed, but strangely enough, an additional adm user with an ID=1002 can ;-)


jupiter66 8 years ago

In Mint 17.2 (at least), this tutorial is not required. The usershares folder is already to root:sambashare and no new guest account has to be created.

Also, it's not true that you can login with your password in a shared folder with only this (out of the box). You have to create the samba password first with:

sudo smbpasswd -a user

Without smbpasswd, share is only possible if you check the guest access box.