HowTo: Create Samba Shares Directly from Thunar

Archived topics about LMDE 1 and LMDE 2
Locked
altair4
Level 20
Level 20
Posts: 11450
Joined: Tue Feb 03, 2009 10:27 am

HowTo: Create Samba Shares Directly from Thunar

Post by altair4 »

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

Linux Mint Debian XFCE Preliminaries.

LMDE needs a little work to get Samba in general and usershares in particular working so if you hadn't done anything to Samba yet I would suggest you look at this part of another HowTo: http://forums.linuxmint.com/viewtopic.p ... 18#p315218

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.

Note: My main XFCE based distro is Xubuntu where this works very well. I have enabled it in Mint's LMDE XFCE and it works just as well but I haven't used it that much to know if there are any problems.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
wayne128

Re: HowTo: Create Samba Shares Directly from Thunar

Post by wayne128 »

This is a very good how-to.

Here is what I tried.

Tried on xubuntu and all is well. However I do not want to use it, because after a few days xubuntu1204 keep crashing...

I would use Debian based, for 'expected stability ( hopefully).. :mrgreen:
Start from LMDE-xfce, I first follow the earlier How to( for LMDE) to get samba set up.
Then follow this tutorial , using thunar , set a directory insider /home/wayne/Public/av test
All is well, this directory can now be accessed by other network computers, including Linux OS and Win7 .

I would like to expand this so that I have some flexibility to use an old computer to just perform simple file server function on additional drives:

1. another internal drive, formatted with ntfs, so that this can be accessed by any win7 computers in the network.

2. external USB drive, formatted with ntfs.

How should I do these?
Thanks in advance.
altair4
Level 20
Level 20
Posts: 11450
Joined: Tue Feb 03, 2009 10:27 am

Re: HowTo: Create Samba Shares Directly from Thunar

Post by altair4 »

You don't have to have an ntfs partition just because the client is Windows.

The only requirement for Usershare is that the person doing the sharing owns the mounted partition - and even that can be overridden. Just right click the ntfs partition ( internal or external ) and select the option you want.

I will depend of course on how you are mounting the partition. For example, if you plug in an external usb drive formatted in ntfs it will mount with "you" as owner and permissions of 700 so only "you" will be able to access it. You can still share it but if you set it to be accessible by guests they will not have access.

You can fix that by adding a line to the [global] section of /etc/samba/smb.conf - right under the workgroup line:

Code: Select all

force user = you
Change "you" to your actual Linux login user name

And then restart samba:

For Debian:

Code: Select all

sudo service samba restart
For Main edition:

Code: Select all

sudo service smbd restart
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Locked

Return to “LMDE Archive”