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
Post Reply
altair4
Level 19
Level 19
Posts: 9225
Joined: Tue Feb 03, 2009 10:27 am

Create Samba Shares from Thunar

Post by 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: 27
Joined: Fri Sep 08, 2017 10:44 pm

Re: Create Samba Shares from Thunar

Post by 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 19
Level 19
Posts: 9225
Joined: Tue Feb 03, 2009 10:27 am

Re: Create Samba Shares from Thunar

Post by 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: 27
Joined: Fri Sep 08, 2017 10:44 pm

Re: Create Samba Shares from Thunar

Post by 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, ....

User avatar
MtnDewManiac
Level 6
Level 6
Posts: 1376
Joined: Fri Feb 22, 2013 5:18 pm
Location: United States

Re: Create Samba Shares from Thunar

Post by MtnDewManiac » Sat Mar 17, 2018 6:08 pm

altair4 wrote:
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.
Or perhaps Clem (et al) feels that those who do use one of those other OS do not constitute the majority of users? If so, it would make sense (IMHO) to include the package in our repositories for those who do require it, but to not install it by default on every user's system.

I have not tried to get my (Mint) system to talk to one of Microsoft's since Mint 14 was still the newest version. I would like to, at some point, if I can ever get that old computer to boot again (graphics card seems to have issues, and the power supply is very close to being dead (if that has not already happened)). I suppose that means I'll have to install - or set up some things - on both computers. I do not intend to serve TO the Windows computer; I only hope to be able to pull some files off of it, if it is not too late to do so.

Would I still need to install the Samba server stuff if I only intend to download from the Windows computer? I'd like to be able to boot the Windows machine (assuming it will, which is questionable) and leave it running for the few minutes at a time it could handle (when it booted) before overheating or whatever it was that kept causing it to die on me under use - and then return to my linux laptop and do all the file transfers (downloads) from there.

Thanks in advance! And thank you, in general, for posting this help thread.

Regards,
MDM
Mint 18 Xfce 4.12.

If guns kill people, then pencils misspell words, cars make people drive drunk, and spoons made Rosie O'Donnell fat.

altair4
Level 19
Level 19
Posts: 9225
Joined: Tue Feb 03, 2009 10:27 am

Re: Create Samba Shares from Thunar

Post by altair4 » Sun Mar 18, 2018 12:04 pm

Would I still need to install the Samba server stuff if I only intend to download from the Windows computer?
Your question really has nothing to do with this Tutorial but ...

Like most things Samba the answer is: it depends. You do not need to install anything on Linux to access a windows box but you must create a share on the Windows box first and then connect to it from Mint. You may find it easier to install samba on your Mint box, create a share, then "push" the files from Windows to Mint rather than "pulling" the files from Windows to Mint.

Given the fragile nature of your Windows box you might want to consider something entirely different: HTTP. There is something in the repository called "droopy" that might be of interest: viewtopic.php?f=150&t=223787&p=1178942#p1178942

It sets up a baby temporary http server on the Mint box with it's own web page that allows you on Windows or any other OS to use your Internet Browser to "upload" files to Mint. The problem here is that we are talking about files not folders. In order to use Droopy with a directory you would need to archive it - zip file for example - and upload that.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

User avatar
MtnDewManiac
Level 6
Level 6
Posts: 1376
Joined: Fri Feb 22, 2013 5:18 pm
Location: United States

Re: Create Samba Shares from Thunar

Post by MtnDewManiac » Sun Mar 18, 2018 7:22 pm

altair4 wrote:
Sun Mar 18, 2018 12:04 pm
Your question really has nothing to do with this Tutorial but ...
In that case, thank you even more for responding. I will refrain from posting more in this thread, and will start a new one if/when I get that old desktop to power up and boot (it will probably be next month when I make the attempt).

You have given me some additional ideas. You also ended up reminding me of a little thing called tiny server, simple server, something like that which Steve Gibson (IIRC) wrote years ago for the Microsoft OS environment, and I may end up looking for that and running it on the Windows box. Ideally, I'd like to "open up" everything - the "C" drive along with some additional internal hard drives installed in that computer - for sharing, but (obviously) only to the other computer accessing the same router. And then to be able to do everything from the (Mint) laptop.

Again, thank you. I hope you leave your reply to me in this thread up, in case the additional information you've provided can help others (even though it isn't directly related to your original tutorial post).

Kind regards,
MDM
Mint 18 Xfce 4.12.

If guns kill people, then pencils misspell words, cars make people drive drunk, and spoons made Rosie O'Donnell fat.

Post Reply

Return to “Tutorials”