0

My system is setup with an Ubuntu 14.04 installation running a 14.04 guest virtual machine, via Oracle's Virtual Box.

I also have 3 x 2TB drives setup in a zpool. To give the virtual machine access to the datasets in the zpool, I've used Virtual Box's shared folders features to share /mnt/[datasets] with the virtual machine. Inside of the virtual machine, they're available as /media/sf_[datasets].

I use the virtual machine for the bulk of my server activities, including running deluge and sickbeard (technically sickrage). My Sickrage setup searches for torrents and deposits them into a folder in /media/sf_dataset1/torrentfolder, which is monitored by deluge and does the actual downloading into /media/sf_dataset1/torrentsdownloaded. Sickrage monitors torrentsdownloaded and post processes into /media/sf_dataset2/Television.

Outside of the virtual machine, in the "base" Ubuntu install, I have a plex server running, and it monitors /mnt/dataset2/[Media Folders].

I just switched to this setup, and noticed that Plex wasn't finding new media, despite it being in the proper place. That led me to check the permissions. After being downloaded, the files have permissions of:

Owner - Read/Write
Group - Read/Write
Others - Read Only

And, because this is inside of the virtual machine, the owner is root and the group is vboxsf.

After Sickrage post processes, the permissions change to

Owner - Read/Write
Group - Read/Write
Others - None

I think this is because Sickrage gives permissions to files based upon the permissions of the directory in which the file is placed. And because these are shared folders, they all have permissions of 770, and I can't change them to 777 (I tried).

Outside of the virtual machine, the permissions on the downloaded files and post-processed files are the same. The owner and group are [user]:[usergroup]. So Plex doesn't have any permissions, and it isn't seeing the files.

One fix for this is to chmod 777 the transferred files. But I don't want to do it manually (the whole system is supposed to be automated). But my idea for an automated solution was a crontab in conjunction with a script to

chmod 777 -R /mnt/dataset2 

every minute. I'm worried that that might damage my drives from too many writes and reads.

Another solution is that I could change the owner of all of the files to [user]:plex. If I do that, I think future post processed files would then be 770, with an owner of user and group of plex. Because user plex, which runs the plex server, is a member of the plex group, that would take care of the permissions issues. The only problem here is that I think I'd have to change deluge to run as user plex. Otherwise, my files would be downloaded with [user]:[usergroup] ownership.

Still, I wanted to bounce this off of the community and see what they say. Would my chmod 777 every minute cause undue stress on my system or drives?

Is there a downside to making plex the owner of all of my files like that? Am I going to have to reconfigure deluge?

Maybe a third option would be to make user plex a member of [usergroup]. But that would give plex access to a lot of files, and doesn't sound ideal.

EDIT:

I've been able to remove some speculation. The fact that this is going on in a VM doesn't seem to matter. I have CouchPotato similarly renaming and moving movie files. After being processed by CouchPotato, the files show up with workable permissions.

This means there must be something strange in SickBeard. I've posted in a Sickbeard-specific forum.

0

If Deluge is creating the files then that is where you need to change the permissions. One solution is to use ACLs, another is to change the umask for the deluge service and add users to the service group.

1
  • Thanks for the response. Wasn't familiar with ACLs, but I'll look into them. As for your Deluge permissions suggestion, that was my initial thought as well, but it doesn't explain why torrents started via CouchPotato are processed as expected. That makes me think the culprit is Sickbeard. – TheSecurityGuy Aug 30 '15 at 18:36
0

Hi I think the answer is in understanding which systems are writing to your data from where and how they access it. I.e. connecting through smb or afp creates different scenarios and connecting through NFS is different again. If you're using afp, I'd recommend switching to smb and if you're connecting through NFS you need to match the uid and gid correctly.

Further if I'm reading correctly you also have a virtual machine connecting through some native VM sharing. Unless that has options for default user, group and mode I'd avoid it and just set it up with OS networking, using e.g. NFS above. This way you can get control over just who your media system thinks is writing your data and what default permissions it requires, maintaining consistency over it. I've just written a guide over on Tech-KnowHow that covers most of this yesterday which may help. Let me know if it doesn't work as it's still relatively fresh in my mind and I may be able to add something further. Good luck.

Direct link: https://www.tech-knowhow.com/2016/03/how-to-plex-permissions-linux/

**Update 27 April 2016 ** I came back to see how you were getting on, it doesn't look like you've resolved this yet? I see your update about Sickbeard and I'm still convinced this is permissions related at the OS level, rather than application specific. Did you get any luck with Sickbeard yet? Linux permissions are a real pain.

There is of course ACL's too, which are somewhat easier to understand, but it does work with standard Linux permissions too once you get your head around them.

Marshalleq

1
  • That's an interesting idea. So you're suggesting instead of using the VMs native folder-sharing system, I should map the various folders via SMB in the VM. I suppose that's one way to make it work. Good out-of-the-box idea. – TheSecurityGuy Mar 14 '16 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.