I've been trying to figure out how to manage a file permissions issue that I'm having, but any combination of things that I've seen in researching the problem haven't resolved my issue.
I have two servers running under a hypervisor at home. One of which is a file server (#fs) and the other is a media server (#plex). I have a separate partition set up that is mounted on fs at /mnt/storage/. There is a sub directory that is a samba share at /mnt/storage/media. I have transmission-daemon running on #fs that downloads to that directory by default, and then I move them to the appropriate subdirectory of movies or tv. Transmission runs on #fs as user @debian-transmission and plexmediaserver runs on #plex as user @plex.
Servers: #plex and #fs Users: @plex and @debian-transmission Shares: $media Groups: %media
The media share is mounted on plex via /etc/fstab at boot with the following line (please disregard the insecure practice of listing the password in /etc/fstab):
//10.0.0.96/media /mnt/shares/media cifs username=plex,password=#REDACTED# 0 0
The media share is shared from fs with the following config in smb.conf
[media] comment = Media files path = /mnt/storage/media read only = no browsable = yes create mask = 0777
On both #fs and #plex, I have tried creating a group called %media and making that group the owner of the directory recursively. On #fs, this seems to work, however, on #plex, it never changes the permission from root root.
Plex needs read write permissions in order to add media to its internal library. Debian-transmission also needs the same in order to be able to download torrents. In some combination of things that I've attempted I've done chmod 777 to $media and still not gotten the desired outcome. Below is the current state of affairs, I'm not sure how to maintain the file permissions when going across a samba share. I don't mind if this winds up with everyone having full access to these shares as this is all at home behind a firewall and is nothing overly important. And of course, I want these permissions to be inherited as when transmission downloads a new torrent, it changes the permissions on the new files/folders.
Members of %media on #plex:
javitab@plex:/$ grep media /etc/group media:x:1005:plex
Members of %media on #fs:
javitab@fs:/$ grep media /etc/group media:x:3081:javitab,plex,debian-transmission
Permissions of /mnt/storage/media on #fs:
javitab@fs:/$ sudo chown -R debian-transmission:media media javitab@fs:/$ ls -la /mnt/storage/ total 36 drwxr-xr-x 5 javitab root 4096 Jun 24 01:53 . drwxr-xr-x 3 root root 4096 Jun 23 15:13 .. drwxr-xr-x 2 javitab root 4096 Jun 24 05:48 javitab drwx------ 2 javitab root 16384 Jun 23 01:32 lost+found drwxrwsrwx+ 4 debian-transmission media 4096 Jun 24 16:31 media
Permissions of /mnt/shares/media on #plex:
javitab@plex:/$ sudo chown -R plex:media /mnt/shares/media javitab@plex:/$ ls -la /mnt/shares/ total 8 drwxr-xr-x 3 root root 4096 Jun 23 23:54 . drwxr-xr-x 3 root root 4096 Jun 23 23:53 .. drwxr-xr-x 2 root root 0 Jun 24 16:31 media