KDE Share setup errors: stuck on permissions

Wait, so you want to share the removable device via samba usersharing feature?

Not sure if that’s a good idea. If you want to unmount and safely remove the device, you will need to unshare it first and stop/restart samba every time you do it.

Anyway, the reason this is not working is because udisks2 is handling the mounting of the removable devices, and you cannot simply change the permissions of the active mountpoint with chmod.

First thing first, samba needs 0751 permissions set on /run/media/$USER directory, and that directory is already mounted via udisks with 0750.

So, the trick is that you need to create the directory with correct permissions yourself, before inserting/mounting the drive. Make sure that the device is NOT inserted/mounted and then run this:

sudo mkdir -p "/run/media/$USER"
sudo chmod 0751 "/run/media/$USER"

Insert the device and try to share your stuff. It works for me™, just tried it out.

The other option is to use bindfs and bind mounts, but that is a more complex setup, and the best option is to use fstab and create a static mount for your device, that you will share with proper samba config, and not via usershares.