KDE Share setup errors: stuck on permissions

I’m trying to share a drive across my network using KDE Share. I’ve been working through the helpful warning/error messages as I go along but now I’m stumped and can’t find an answer while searching.

The current warning is

This folder needs extra permissions for sharing to work.

It offers a fix permissions that fails, but shows current permissions are rwxr-x--- (0750) but needs to be rwxr-x--x (0751).

I have changed permissions using sudo chmod -R 0751 /var/lib/samba/usershares but it changes the warning to This folder can't be shared because your user account doesn't have permission to write into /var/lib/samba/usershares. I also threw in a reboot just in case, but the error remains.

Maybe try sudo su first and then try chmod?

Ugh. No matter how many times I change permissions it just isn’t saving. The error is /run/media/username/drive_name needs to be 0757 and it remains 0755.

Tried sudo su, restarted services, updated EOS, rebooted, nothing is working. :woozy_face:

:person_shrugging: Could possibly be a bug. Might be worth submitting.
Otherwise, you could try the KDE forum.

1 Like

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.

2 Likes

Exactly what I’m trying, and appreciate the unmount/safe removal warning! It’s not a portable drive and it’s a desktop computer so it will stay in place, but still good to know this in case I do need to move these things around.

I’ll give this a try at my first opportunity today, thank you for the explanation and instructions too!

If it’s not going to be removed consider creating static mount points.

Also, one thing I forgot to mention is that items in /run directory are on tmpfs so everything will be cleared upon reboot, and you will need to recreate the directory every time.

To avoid that, you can create tmpfiles.d config and let systemd recreate the folder for you

sudoedit /etc/tmpfiles.d/run-media-user.conf
D /run/media/your_username_here 0751 root root
2 Likes