BIPEDU

my ideas in action

Add right-click Samba share in Thunar/XFCE file manager

Since I use XFCE4 I was searching a easy way to temporarily share a folder to another PC over the network.

Gnome have a nice and easy way of doing this with a right-click on a selected folder.

But for XFCE there is no such option available. But to fix this you have to create a “custom action”.

Note 1: Samba must be installed for this method to work !

Note 2: I tested this solution on Mint 13/XFCE 64bit. It should work also on Ubuntu 12.04 and higher or similar Linux distros.

Step 1:

In Thunar go to Edit–>Configure custom actions…

xfce_samba2

Then add a new custom action:

xfce_samba4

The command is :

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

Notice: copy the above command as it is. The shared folder will have the same icon (not like in Gnome with the special “share” folder icon).

Go on “Appearance conditions” tab and there click only on Directory and remove all the others. The main idea is to see this “share” option only if you selected a folder.

xfce_samba5

Step 2:

Create another custom action for removing the folder from Samba share. The steps are similar but the command is :

net usershare delete %n

xfce_samba8

On the “appearance condition” tab select Directory only.

So at the end you should have two custom actions like in the below example:

xfce_samba10

Step 3: test the new created menu.

Select a folder and right-click and select the share menu you just created. In few seconds you should see that folder on your Samba share. Like this:

xfce_samba7

If you are not sure how to access your Samba shares then you have to type “smb://computername/folder/” like in the above image (in to the address bar). If for some reasons it is not working you can try with the IP address of that PC like : smb://192.168.1.5/

The samba shares can be accessed from any Windows/Linux/Mac computer from any file manager like : Explorer, Dolphin, Nautilus, Thunar, Midnight Commander, total Commander, any web browser…etc

To unshare (not share publicly the folder) you have to make right-click on the same folder but choose the second menu with “unshare”. In few seconds the shared folder will not be publicly available.

Tricks :

  • If you need to write from another computer on to the shared folder then you have to give permision to write (chmod) on that shared folder. You can do this directly inside the custom action command like this :

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

It is preferable to use for this a empty folder since it may be dangerous to give 777 permission to everyone.

  • The commands described above can also be run in terminal but you have to replace the %n, %f with the correct values. See above pictures for details.

10 responses to “Add right-click Samba share in Thunar/XFCE file manager

  1. Ticrob January 1, 2014 at 1:29 PM

    Hi Bipedu. I have try your trick with Linux Mint Petra XFCE. The first time it doesn’t work. I didn’t undertand why until I notice a typographic mistake in your post. Indeed, if we do a copy/paste with your command line :
    net usershare add %n %f “” Everyone:R guest_ok=y
    The problem is your “”. This typo is not recognize by thunar. It must be replaced by “”. Then it’s works 😉
    In my case I have changed
    net usershare add %n %f “” Everyone:R guest_ok=y
    by
    net usershare add %n %f “” Everyone:R guest_ok=n
    Unfortunately, when I try to open the Linux share folder from my W$7 or from my another Linux Petra XFCE PC, I do not succed…my login and password are rejected. I don’t yet understand why…Then until I find an answer I have to allowed everyone… 😦

    Ps : Happy new year ! 🙂

    • bipedu January 3, 2014 at 1:36 PM

      Sorry about that, I copied the text and I didn’t noticed that WordPress changed the “”.

      If it is not working from any Win or Linux machine then it may be a problem with your Samba setup.
      Please check carefully the setup files and test it from another PC.

      Happy New Year !

  2. twig January 8, 2014 at 11:17 AM

    I was having some issues with LinuxMint 16 XFCE and this fixed it up perfectly. So glad it persists across reboots as well.

    Great post, thanks for that!

  3. Vishal February 3, 2014 at 1:53 PM

    worked like charm!

  4. yance September 23, 2014 at 5:20 AM

    very help, thank alot. works for me on mint 17 xfce

  5. Fabio Amaral May 24, 2015 at 3:37 AM

    Perfect! Works like a charm! 🙂

  6. JR May 24, 2015 at 4:21 PM

    Thank you Bipedu!!! – worked like a charm on my rig (Mint 17 Xfce 64-Bit).

  7. Fred September 26, 2015 at 10:07 AM

    Thank you very much. It works great!

  8. Pingback: Thunar Samba Share | Andreas' Blog

  9. cucrainbow July 5, 2018 at 7:23 PM

    Mint 19 xfce – brilliant, you don’t know how appreciated that is…! Thanks.

Leave a comment