USB drives are mounted with the same permissions the users which runs Kodi has.

I use DietPi mainly as media player, so I configured it to start Kodi after the boot. Kodi has the useful feathure that makes usb drives auto mounted once plugged in. The problem is that, since Kodi runs with root permissions, the drive is mounted with its permissions. Moreover Kodi controls don’t work if launched by another user.

Any clues in order to have drive accessible by a normal user?

Hi,

the USB drive is not mounted with a specific permission. The device is mounted to a specified folder that has a permission. as well directories on the drive have their own permission. While you drive is mounted, you could change the permission and allow other user

You could make Kodi run as a different user. Open dietpi-services, select kodi, select Edit, and add User=yourUser below the [Service] line. In case, you need to add the user to additional groups to grant access to GPU and audio devices:

usermod -aG audio yourUser # ALSA/audio device access
usermod -aG video yourUser # General video/X server access
usermod -aG render yourUser # DRM access, required on RPi and Odroid N2+C4
usermod -aG dietpi yourUser # To access media/downloads with default permissions on DietPi

Probably more is required to make it run fully featured not sure. Report back how it works, I anyway plan to run Kodi as own user “kodi”, group “dietpi” and UMask 002 in the future to limit it’s permissions to what is required and allow easier cross access for other users.

Hi,
I gave the directory all the possible permissions,

root@DietPi:/media# ls -l /media/                                            │
totale 4                                                                     │
drwxrwxrwx+ 3 root users 4096 dic  8 20:57 root

and still I cannot let other users to access it:

daniele@DietPi:~ $ cd /media/root/
-bash: cd: /media/root/: access denied

what about the permission of /media

Hi, here you go:
$ ls -lsd media/
4 drwxr-xr-x 3 root root 4096 mag 17 2020 media/

There is no kodi instance in that list.

Bump!

Ah lol, of course there is no Kodi service, sorry my fault. dietpi-autostart allows to chose which user shall start Kodi.