Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Writing to cifs/smb share using emby server account failing

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
invader
Posts: 1
Joined: 2022-07-06 02:08

Writing to cifs/smb share using emby server account failing

#1 Post by invader »

Hi there. I’ve been trying to troubleshoot this issue for a while now. I’m basically running an Emby server and having issues writing to a mounted SMB share. The strange part is outside Emby the permissions seem to be fine. I realise this sounds like a specific software issue however I think it’s something more general. Like Emby server running using systemd's DynamicUser feature and therefore not having write permissions. Something like that, I’m just not sure.

I've created a few fresh installs on my Raspberry Pi and most recently I used Ubuntu which actually worked! So there must be something specific to Raspberry Pi OS or a setting that I'm not aware of that's causing the issue.

I’d really appreciate any help with this. Please note, I would prefer not to use nfs although I realise this may be a work around.

My specs and troubleshooting below.

Raspberry Pi OS Version:

Code: Select all

cat /etc/os-release
Raspbian GNU/Linux 11 (bullseye)
Emby Server 4.7.2.0


Creating directories to mount in

Code: Select all

pi@raspberrypi:~ $ mkdir embyMovies
pi@raspberrypi:~ $ mkdir piMovies
Changing permissions of directories

Code: Select all

pi@raspberrypi:~ $ sudo chown -R emby:emby /home/pi/embyMovies
pi@raspberrypi:~ $ sudo chown -R pi:pi /home/pi/piMovies
Checking permissions

Code: Select all

pi@raspberrypi:~ $ ls -l
total 74684
-rw-r--r-- 1 pi   pi         36 Jun 16 21:55 cred
drwxr-xr-x 2 emby emby     4096 Jun 17 12:32 embyMovies
drwxr-xr-x 2 pi   pi       4096 Jun 17 12:32 piMovies
Attempt to write to “/home/pi/embyMovies” using Emby server. (before cifs/SMB mount)
I’m using the backup plugin to perform the write tests as it’s the quickest way I’ve found to try and write a file using Emby server.

This was successful.

Attempt to write to “/home/pi/piMovies” using Emby server. (before cifs/SMB mount)
Failed.
System.UnauthorizedAccessException: System.UnauthorizedAccessException: Access to the path '/home/pi/piMovies/Emby Backup - 2022-06-20 08.7.27 - Auto' is denied.
---> System.IO.IOException: Permission denied

This makes sense. The piMovies folder doesn’t have Emby user permissions. These 2 tests confirm that Emby is using the Emby account and write permissions work before the SMB/cifs mount.

Mounting the SMB paths
/etc/fstab contents

Code: Select all

proc            /proc           proc    defaults          0       0
PARTUUID=2cf82d9c-01  /boot           vfat    defaults,flush    0       2
PARTUUID=2cf82d9c-02  /               ext4    defaults,noatime  0       1
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that
//nas/Movies/home/pi/piMovies cifs x-systemd.automount,uid=pi,gid=pi,credentials=/home/pi/cred,iocharset=utf8,vers=3.0,noperm 0 0
//nas/Movies/home/pi/embyMovies cifs x-systemd.automount,uid=emby,gid=emby,credentials=/home/pi/cred,iocharset=utf8,vers=3.0,noperm 0 0

Checking file permissions for SMB mount (embyMovies)

Code: Select all

pi@raspberrypi:~/embyMovies $ cd .ignored
pi@raspberrypi:~/embyMovies/.ignored $ ls -l
total 0
drwxr-xr-x 2 emby emby 0 Jun 16 21:46 'Emby Backup'
drwxr-xr-x 2 emby emby 0 Jun 17 07:26 'Emby Backup - 2022-06-17 07.26.0 - Auto'
drwxr-xr-x 2 emby emby 0 Jun 17 07:31 'Emby Backup - 2022-06-17 07.31.57 - Auto'
drwxr-xr-x 2 emby emby 0 Jun 17 07:34 'Emby Backup - 2022-06-17 07.34.3 - Auto'
drwxr-xr-x 2 emby emby 0 Jun 17 07:38 'Emby Backup - 2022-06-17 07.38.24 - Auto'
drwxr-xr-x 2 emby emby 0 Jun 17 08:21 'Emby Backup - 2022-06-17 08.21.35 - Auto'
drwxr-xr-x 2 emby emby 0 Jun 17 08:21 'Emby Backup - 2022-06-17 08.21.6 - Auto'

pi@raspberrypi:~/embyMovies/.ignored/Emby Backup $ cd 'Emby Backup - 2020-08-31 00.10.0 - Auto'
pi@raspberrypi:~/embyMovies/.ignored/Emby Backup/Emby Backup - 2020-08-31 00.10.0 - Auto $ ls -l
total 12
drwxr-xr-x 2 emby emby    0 Aug 31  2020 dlna
drwxr-xr-x 2 emby emby    0 Aug 31  2020 library
-rwxr-xr-x 1 emby emby   34 Aug 31  2020 mb.lic
drwxr-xr-x 2 emby emby    0 Aug 31  2020 plugins
-rwxr-xr-x 1 emby emby   12 Aug 31  2020 profile.txt
drwxr-xr-x 2 emby emby    0 Aug 31  2020 ScheduledTasks
-rwxr-xr-x 1 emby emby 2833 Aug 31  2020 system.xml
drwxr-xr-x 2 emby emby    0 Aug 31  2020 userdata
drwxr-xr-x 2 emby emby    0 Aug 31  2020 users
Checking file permissions for SMB mount (piMovies)

Code: Select all

pi@raspberrypi:~/piMovies $ cd .ignored
pi@raspberrypi:~/piMovies/.ignored $ ls -l
total 0
drwxr-xr-x 2 pi pi 0 Jun 16 21:46 'Emby Backup'
drwxr-xr-x 2 pi pi 0 Jun 17 07:26 'Emby Backup - 2022-06-17 07.26.0 - Auto'
drwxr-xr-x 2 pi pi 0 Jun 17 07:31 'Emby Backup - 2022-06-17 07.31.57 - Auto'
drwxr-xr-x 2 pi pi 0 Jun 17 07:34 'Emby Backup - 2022-06-17 07.34.3 - Auto'
drwxr-xr-x 2 pi pi 0 Jun 17 07:38 'Emby Backup - 2022-06-17 07.38.24 - Auto'
drwxr-xr-x 2 pi pi 0 Jun 17 08:21 'Emby Backup - 2022-06-17 08.21.35 - Auto'
drwxr-xr-x 2 pi pi 0 Jun 17 08:21 'Emby Backup - 2022-06-17 08.21.6 - Auto'
pi@raspberrypi:~/piMovies/.ignored $

pi@raspberrypi:~/piMovies/.ignored $ cd 'Emby Backup'
pi@raspberrypi:~/piMovies/.ignored/Emby Backup $ cd 'Emby Backup - 2020-08-31 00.10.0 - Auto'
pi@raspberrypi:~/piMovies/.ignored/Emby Backup/Emby Backup - 2020-08-31 00.10.0 - Auto $ ls -l
total 12
drwxr-xr-x 2 pi pi    0 Aug 31  2020 dlna
drwxr-xr-x 2 pi pi    0 Aug 31  2020 library
-rwxr-xr-x 1 pi pi   34 Aug 31  2020 mb.lic
drwxr-xr-x 2 pi pi    0 Aug 31  2020 plugins
-rwxr-xr-x 1 pi pi   12 Aug 31  2020 profile.txt
drwxr-xr-x 2 pi pi    0 Aug 31  2020 ScheduledTasks
-rwxr-xr-x 1 pi pi 2833 Aug 31  2020 system.xml
drwxr-xr-x 2 pi pi    0 Aug 31  2020 userdata
drwxr-xr-x 2 pi pi    0 Aug 31  2020 users
pi@raspberrypi:~/piMovies/.ignored/Emby Backup/Emby Backup - 2020-08-31 00.10.0 - Auto $

Attempt to write to “/home/pi/embyMovies” using Emby server. (after SMB mount)
Failed

Code: Select all

System.UnauthorizedAccessException: System.UnauthorizedAccessException: Access to the path '/home/pi/embyMovies/.Ignored/Emby Backup - 2022-06-20 08.13.14 - Auto/profile.txt' is denied.
---> System.IO.IOException: Permission denied
I found this:
https://wiki.archlinux.org/title/Emby
Emby runs under the user and user group emby using systemd's DynamicUser feature. By default, Emby will have at most read permissions to your media files thanks to systemd's filesystem abstraction.
I tried what was suggested here but I didn't really understand it. Mentioning it because maybe it is related to the issue and maybe I applied it incorrectly to Raspberry Pi OS.

When I tried Ubuntu Ubuntu 20.04.4 LTS following the same tests above, writing worked fine however I'm finding Raspberry Pi OS is compatible with everything I need to run, unlike Ubuntu. Also seems much faster, even in terminal.

Post Reply