my ideas in action
Add right-click Samba share in Thunar/XFCE file manager
January 15, 2013Posted by on
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.
In Thunar go to Edit–>Configure custom actions…
Then add a new custom action:
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.
Create another custom action for removing the folder from Samba share. The steps are similar but the command is :
net usershare delete %n
On the “appearance condition” tab select Directory only.
So at the end you should have two custom actions like in the below example:
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:
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.
- 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.