Can't share folders (16.10)

On my main PC (which was on Ubuntu Mate 16.10), I used to be able to share folders through Samba by going in the share tab in the properties. I’ve just reinstalled the OS from scratch and it doesn’t work anymore. I’ve installed caja-share and when I try to setup a shared folder, I get the following error message:

'net usershare' a renvoyé une erreur 255: mkdir failed on directory /var/run/samba/msg.lock: Permission non accordée
net usershare: cannot open usershare directory /var/lib/samba/usershares. Error Aucun fichier ou dossier de ce type
Please ask your system administrator to enable user sharing.

What should I do (and why doesn’t it work automatically)?

It looks to me like you need to give the user trying to initiate the share write access to /var/run/samba/ or set the share up with admin permissions, maybe?

The point of usershares is especially to be able to share folder without admin rights or tweak the samba config. I’m not sure about the permissions on /var/run/samba and/or /var/lib/samba/usershares but that issue never happened before, I don’t know if I should change them manually, to what, and why doesn’t Mate do it as expected. It might also be a missing group but I’m not sure which one either (nor why Mate doesn’t add users to it automatically if that’s the case).

I’ve kept the content of my old hard drive and just checked the content of the old /var/lib/samba.

On the old setup:

-rw-------  1 root root     421888 juil. 11  2015 account_policy.tdb
-rw-------  1 root root        696 juil. 11  2015 group_mapping.tdb
drwxr-xr-x 10 root root       4096 juil. 11  2015 printers
drwxr-xr-x  3 root root       4096 avril 19  2016 private
-rw-------  1 root root     528384 juil. 11  2015 registry.tdb
-rw-------  1 root root     421888 févr. 17 14:49 share_info.tdb
drwxrwx--T  2 root whoopsie   4096 janv. 28 11:40 usershares

On the new setup:

drwxr-xr-x 2 root root 4096 sept. 18 12:26 private

So, there is indeed quite some differences. I assume that the .tdb files are databases containing the sharing info and I’d just need to setup the usershare directory. There are two small issues, though:

  • I’m not sure what this “T” is instead of an “x” in the permissions flags
  • I’m not sure of the group, as “whoopsie” is just the name of the group on my new setup that has the same ID as one on the old setup: maybe “samba”?

"When the sticky bit is set on a directory, files in that directory may only be unlinked or renamed by root or the directory owner or the file owner."

Thanks. But how do I set it? The chmod man references it but I dont see a specific option. Should I just do a chmod o+T?

Also, any idea about what the group should be for the directory?

I don’t know about the usershares folder; I don’t have one. I just have the private.

I don’t actually use samba on any of my machines. I have a NAS for that.

chmod o+t should add the sticky bit.

http://www.linuxnix.com/sticky-bit-set-linux/

Thanks for the help but I just managed to fix the problem by… installing the samba package. It creates the usershares dir with the right permissions (the right group name is “sambashare”).

So, I guess there’s a missing dependancy on the caja-share package, as it only installs samba-common, samba-common-bin and samba-libs.

EDIT: turns out there was a bug report on Launchpad already.

1 Like