Create Samba Shares from Thunar

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
altair4
Level 18
Level 18
Posts: 8832
Joined: Tue Feb 03, 2009 10:27 am

Create Samba Shares from Thunar

Postby altair4 » Sat Dec 10, 2016 3:27 pm

Note: This isn't new folks. The original was moved to the wrong subsection of the forum and subsequently locked and I cannot convince anyone to place it back where it was originally.

Create Samba Shares Directly from Thunar

Once upon a time Thunar had a plugin called thunar-shares-plugin which resembled nautilus-shares in Gnome allowing the user to create samba usershares directly from Thunar itself without using any other utility. Thunar-shares-plugin is broke. It's not offered in Xubuntu because it's broke but it is available in Debian presumably because they don't know it's broke. This is my feeble attempt to bring some of that functionality back to Thunar using "User Custom Actions".

Note: To those who are unfamiliar with this type of share it's what Samba refers to as a "Usershare". It's designed to allow any user to create a samba share of any folder he owns without becoming root. The share definition it creates is not in /etc/samba/smb.conf like Classic- shares but in /var/lib/samba/usershares. For more on userhsares: http://forums.linuxmint.com/viewtopic.php?f=42&t=23169

Remember folks Mint no longer installs the samba server package by default so you need to do that first:

Code: Select all

sudo apt-get install samba --install-recommends


Thunar Shares

Open Thunar and Select Edit > Configure Custom Actions > +

Basic Tab:
Name: Samba Public Read Only
Command:

Code: Select all

net usershare add %n %f "" Everyone:R guest_ok=y

Appearance Conditions Tab:
Make sure only Directories is enabled.

Restart Thunar and right click a directory in your home folder, say Documents, and select "Samba Public Read Only". To check if it has done it correctly run the following command to see the share definition:

Code: Select all

net usershare info --long

It should look like this if it's done it correctly:
[documents]
path=/home/altair/Documents
comment=
usershare_acl=Everyone:R,
guest_ok=y


I will list all the possible permutations here. Just use the same procedure as outlined above:

Samba Public Read Only

Code: Select all

net usershare add %n %f "" Everyone:R guest_ok=y

Samba Public Writeable

Code: Select all

net usershare add %n %f "" Everyone:F guest_ok=y && chmod 777 %f

Samba Private Read Only

Code: Select all

net usershare add %n %f "" Everyone:R guest_ok=n

Samba Private Writeable

Code: Select all

net usershare add %n %f "" Everyone:F guest_ok=n && chmod 777 %f

Samba Share Remove

Code: Select all

net usershare delete %n && chmod 755 %f


The use of User Custom Actions that I've outlined above reproduces only half of the functionality of nautilus-shares:

What it can do:
Create a samba usershare.
Change permissions on the target folder allowing write access to samba clients.

What it can't do:
Nautilus-shares and Thunar-shares had a GUI which showed you available options and those you have already selected.
Nautilus-shares but not Thunar-shares changed the folder icon to show you that the folder was shared.
Last edited by altair4 on Thu Dec 07, 2017 8:56 am, edited 1 time in total.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

brvcf
Level 1
Level 1
Posts: 16
Joined: Fri Sep 08, 2017 10:44 pm

Re: Create Samba Shares from Thunar

Postby brvcf » Thu Dec 07, 2017 12:19 am

This did not work for me in XFCE 18.2 until I did

Code: Select all

sudo apt-get install samba --install-recommends

which makes no sense because previous to trying to make a share in Mint I had no problems accessing Windows shares from Mint.

altair4
Level 18
Level 18
Posts: 8832
Joined: Tue Feb 03, 2009 10:27 am

Re: Create Samba Shares from Thunar

Postby altair4 » Thu Dec 07, 2017 8:54 am

Yes, I keep forgetting Mint doesn't install samba by default any more. I'll add another step to the main HowTo. Thanks.

which makes no sense because previous to trying to make a share in Mint I had no problems accessing Windows shares from Mint.

Two different sambas. The samba server package samba is no longer installed by default in Mint. I'm guessing they think no one uses Windows or MacOS. The samba client package - actaully only a samba client library not the whole thing - is installed by default most likely because it's a dependency of gvfs-backends. It's the samba client that can access your WIndows shares.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

brvcf
Level 1
Level 1
Posts: 16
Joined: Fri Sep 08, 2017 10:44 pm

Re: Create Samba Shares from Thunar

Postby brvcf » Wed Dec 20, 2017 3:22 pm

Yes, I keep forgetting Mint doesn't install samba by default any more. ...


You know we criticize Microsoft for changing things for apparently no good reason so that some well-established procedure doesn't work any more. This is one of the things (along with the whole forced and flaky update debacle) that really ticked me off about Windows 10 and helped push me to get serious about Linux.

I think Linux developers (especially of distributions such as Mint that are promoted as replacements for Windows for the average user) have to be careful to avoid that wherever possible.

One of the things that I find most frustrating about trying to find out how to do something in Linux is that there is no comprehensive documentation for any distribution, so you have to search forums and such. You get all kinds of results which may or may not apply or be correct. You have to look very carefully at the date of the answers as well as the details of the distribution even within the same family (i.e. Mint XFCE with Thunar vs. Mint Cinnamon with nemo, etc.) and is it for 12,13,14, 15,16,17,18, ....


Return to “Tutorials”