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

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
dgiglio
Posts: 8
Joined: Sun Nov 03, 2019 10:32 am

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

Post by dgiglio »

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?
User avatar
Joulinar
Posts: 3807
Joined: Sat Nov 16, 2019 12:49 am

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

Post by Joulinar »

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
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 2628
Joined: Sat Nov 18, 2017 6:21 pm

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

Post by MichaIng »

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:

Code: Select all

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.
dgiglio
Posts: 8
Joined: Sun Nov 03, 2019 10:32 am

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

Post by dgiglio »

Joulinar wrote: Tue Nov 10, 2020 12:13 am 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
Hi,
I gave the directory all the possible permissions,

Code: Select all

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:

Code: Select all

daniele@DietPi:~ $ cd /media/root/
-bash: cd: /media/root/: access denied
User avatar
Joulinar
Posts: 3807
Joined: Sat Nov 16, 2019 12:49 am

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

Post by Joulinar »

what about the permission of /media
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
dgiglio
Posts: 8
Joined: Sun Nov 03, 2019 10:32 am

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

Post by dgiglio »

Joulinar wrote: Sun Dec 13, 2020 2:09 am 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/
dgiglio
Posts: 8
Joined: Sun Nov 03, 2019 10:32 am

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

Post by dgiglio »

MichaIng wrote: Tue Nov 10, 2020 12:22 am You could make Kodi run as a different user. Open dietpi-services, select kodi,
There is no kodi instance in that list.
dgiglio
Posts: 8
Joined: Sun Nov 03, 2019 10:32 am

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

Post by dgiglio »

Bump!
User avatar
MichaIng
Site Admin
Posts: 2628
Joined: Sat Nov 18, 2017 6:21 pm

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

Post by MichaIng »

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