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.