Hardware: Dell R720 YunoHost version: Powered by YunoHost 4.0.6.1 (stable). I have access to my server : SSH, webadmin, direct access Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : not really. I have a RAID server.
Description of my issue
I have all of my media at /var/Multimedia/Picture (or Video, or eBook, etc)
This is because these are 2TB large and mountpoint is at /var. Yunohost is on / which is much smaller
Jellyfin can read the media on /var/Multimedia just fine, as can other apps
I want to use nextcloud to ease adding/removing files to /var/Multimedia
Iāve tried creating a nextcloud instance and then creating symbolic links like
ln -s /home/USER/yunohost.multimedia/Picture /var/Multimedia/Picture
or in /home/USER/share/Multimedia/Picture
In both cases nextcloud doesnāt read the files.
I also notice these in NC logs:
Following symlinks is not allowed ('/home/USER/Multimedia' -> '/home/yunohost.multimedia/USER/' not inside '/home/USER/')
Following symlinks is not allowed ('/home/yunohost.multimedia/USER/Picture/Picture' -> '/var/Multimedia/Picture/' not inside '/home/yunohost.multimedia/USER/')
Initlally when I installed NC I got an error about not having permission to create files so I tried following this YNH guide to permanently set NC to /var/Multimedia (preferred option) but eventually when I ran
sudo -u nextcloud php occ files:scan --all
I got the error that "you donāt have permission to run as www-data, this can be solved by giving access to webserver to config. I tried scrwing acround with chown and chgrp a dozen times but to no avail.
I might have borked this NC install, which is fine, and I can delete it and reinstall it but Iāve done this a few times now so I thought Iād ask for help
But whatās your initial issue ? (you just jumped right into technical details without explaining whatās your issue / what youāre trying to achieve ā¦)
Here is what I did for a similar issue (between Syncthing, Nextcloud, and direct root mounts). Add jellyfin and nextcloud to each otherās group:
sudo usermod jellyfin -a -G nextcloud
sudo usermod nextcloud -a -G jellyfin
Then it depends on how you have mounted /var/Multimedia. The idea is to give the same permissions to both users.
If itās a ext4 or equivalent partition, you need to chmod:
find /var/Multimedia -type d -exec chmod 0775 {} \;
find /var/Multimedia -type f -exec chmod 0664 {} \;
If its user, groups, and permissions are set as /etc/fstab options, I guess they are already set accordingly. If not, report back here, we will need to tune the uid, gid, fmask, and dmask options.
You may need to restart Jellyfinās, NGINX, and PHP-FPM services.
Then you can add /var/Multimedia to Nextcloud external mounts (as a local directory, in its admin panel).
it seems like I did something when fucking around with permissions and now jellyfin canāt access /var/Multimedia anymore either. so Iāll have a go at the commands you list here.
If I installed Ampache would I do a similar thing as you list here:
Please share your /etc/fstab and the result of ls -la /var/Multimedia (remove any confidential information, obviously), so that we can all be on the same page.
I would guess so, yes. Do not forget to do the same for ampache user.
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda3 during installation
UUID=BLABLA14d460438bee / ext4 errors=remount-ro 0 1
# /boot/efi was on /dev/sda1 during installation
UUID=BLABLA-E8D0 /boot/efi vfat umask=0077 0 1
# /var was on /dev/sdb during installation
UUID=BLABLA-3e3e80b219e3 /var ext4 defaults 0 2
# swap was on /dev/sda2 during installation
UUID=BLABLA-83f9ea24bb0f none swap sw 0 0
/dev/sr0 /media/cdrom0 udf,iso9660 user,noauto 0 0
/swap_seafile swap swap defaults 0 0 #Swap added by seafile
ls -la /var/Multimedia (before running the commands above:
I see that you used the ACLs (+ at the end of the permissions). They seem quite powerful but I am not used to them.
I have also realized that giving Nextcloud access to all Jellyfin files and vice-versa is not really safe, so letās use an intermediary group multimedia.
Letās reset everything.
sudo su
# Let's remove the previous unsafe groups
deluser jellyfin nextcloud
deluser nextcloud jellyfin
# Let's create the group and add its users
groupadd multimedia
usermod jellyfin -a -G multimedia
usermod nextcloud -a -G multimedia
# Are you sure there is a upper case A in Ampache ?
usermod Ampache -a -G multimedia
# Set permissions
chown nextcloud:multimedia -R /var/Multimedia
find /var/Multimedia -type d -exec chmod 0775 {} \;
find /var/Multimedia -type f -exec chmod 0664 {} \;
# Set ACLs (I did some research :p)
# Users will get ownership of their own files,
# but the group will always be multimedia
# I left the r permission to other, but you can replace it with 0
# if you only want the apps listed above to access the files
setfacl -d -m u::rwX,g::rwX,o::r /var/Multimedia
# Restart services
systemctl restart nginx
systemctl restart php7.3-fpm
systemctl restart jellyfin
Then add the external mount /var/Multimedia into Nextcloud. Jellyfin should now have write access to the directory too.
thank you so much for your help and clear descriptions!!
I just want to complement you on how beautifully written these commands are! the setfacl -d -m u::rwX,g::rwX,o::r /var/Multimedia is so well done! thank you and Iām glad you learned something from it!
No, Ampache is definitely āampacheā but my phone wanted to initial cap it first.
The files seem like they show up in nextcloud, but the storage all shows as āpending.ā I am not sure if this is because I was using symbolic links beforehand on the /var/Multimedia (to link them from /home/USER/yunohost.multimedia folders or if it is because it just takes NC awhile to read everything. I will try to poke around and delete symbolic links
Okay: NC has access to /home/USER/Multimedia and /home/yunohost.multimedia/share/ and shows them here as Multimedia and Shared Multimedia respectively:
jellyfin does not seem to have access to /var/Multimedia and Ampache does not list anything currently (but might need to play around with settings).
Ah! Iām an idiot, they totally show up in Nextcloud after I take the step of adding them via āExternal Storageā
re: JellyfināI thought I would just delete and reinstall but the install failed (if youāre very curious here are the logs: https://paste.yunohost.org/raw/hatixexudu) but it seems to be a jellyfin issue not a permissions issue, so Iāll chase that down. Thanks for giving me a guide (more or less) on how to do things going forward!
I think this may have been created as a side effect of the non-handling of symlinks by Nextcloud. If there is no data belonging to you in it, you can delete it yes.
Do not hesitate to report back here when Jellyfin is fixed. Did you have any luck with Ampache, finally?