File permissions no longer automatically working

Server Version#: Ubuntu 18.04 LTS
Player Version#: 1.15.8.1198

Up until the last two or three days, I was able to download my video files on one computer, copy them up to a local NAS and then down to my Plex server using folders like alpha and beta (not their real names).

Then I noticed that my Plex wasn’t adding my latest files to Recently Added. I checked out some posts and found that I had to change the permission settings on the folders/files to get Plex to see them.

Just to double-check, my folders are chown myname.myname and should be chmod 775 while my files are chown myname.myname and chown 664, is that correct?

I saw something in one of the posts that referenced plex.plex. I have a plex user (plex:x:132:video:x:44:plex) and a video group with a plex user (video:x:44:plex). Should I have something different?

And, other than updates, I haven’t changed anything on either computer recently so why the sudden need to file permissions?

Thanks in advance.

I hope this is an error in how you posted to the forum.

(plex:x:132:video:x:44:plex) 

If not, you have two merged into one line, which is invalid.

video:x:44:plex
plex:x:132:

This, however, won’t impact file permission. THis is for HW transcoding permissions (group file)

Something between your computer and how it authenticates on the NAS (UID mismatch?) is now interfering.

While a bit of work to set up, I use UID - matching over NFS with the NAS.

User plex, and my username, have the same user-id number on both systems.

Yes, it was a botched cut and paste. My groups show two lines (video… and plex…). I also added a media group like you suggested in other posts (media:x:1001:myname,plex).

I also made the changes you suggested in your “Automating Linux permissions using inheritance” post so my folders & files are now myname.media and my folders are 755 and my files are 644.

After a reboot, I’m assuming I need to do a Scan Library Files because some files are working and others aren’t.

Also, if I wanted my Plex server to be able to delete files from my TV, the folders would need to be 775 instead of 755, correct?

Thanks for your help.

If you want Plex to write content (modify the directory by creating files – which includes deletion), Yes, you change the directory perm to 775 (give group +w under the g+ws)

Thanks.

So, as far as I can tell, all my folders and files have they’re permissions set correctly and the Plex app on my Tivo can see them but none of them will play.

Suggestions?

That just changed from Server-based to App based.

Please verify: Settings - server - general - show advanced - DEBUG on – VERBOSE off.

Recreate the problem.
wait 30 seconds
Settings - Server - Troubleshooting - Download Logs
Attach the ZIP it gives you here.

1 Like

I think a few reboots and several Scan Libraries have fixed most of my problems. If I find any files that give me trouble in the next three months, I’ll send the log files.

Thanks again for all your help.

1 Like

Well, everything is working up to a point. After downloading the video files to my Plex server, I have to manually chmod 644 them for the app to see/play them. The files are defaulting to 600.

Suggestions?

However you’re adding files, your default umask is not setting permissions correctly.

Setting a umask 022 in your .profile will result in permissions 0644 when files are created unless you are downloading/using a tool and that program is expressly settings 600

Understood.

I use qBittorrent for my downloading and I checked the download folder and the files are set to 664 (that’s before I move them to the NAS and then move them to a folder on my Plex server). They end up as 600 on the Plex server folder.

When you say .profile, do you mean the plexmediaserver.service file?

When I say .profile , I mean precisely that. It’s the file the shell executes just prior to showing you the command prompt.

plexmediaserver.service is the Plex service control mechanism. It handles all the aspects of starting and stopping Plex itself.

Which “Plex server” directory are you talking about? Where are these files being written to? This is making me very nervous and might be why you’re having problems.

/home/myname >>> plex >>> movies
tvshows

etc.

I’ve been using this command (sudo find /home/myname/plex -type f -exec chmod 644 {} :wink: to fix the files and a similar one to change the folders from “plex” on down to 755.

I tried finding the “.profile” file with no success. Where is it normally located?

Putting media in your home directory is extremely problematic, which you are now learning.

Linux default security doesn’t easily let two users (you and plex) share the files when they are in either’s home directory.

I know this is a pain but here’s what I recommend:

I recommend setting up a shared area where Linux takes care of the permissions for you.

# elevate to root user
sudo sh

# make a place in /home for you and plex to share
mkdir /home/plexmedia

# now create your movies, television, music, photos, or other videos however you want it organized.

cd /home/plexmedia
mkdir movies tv music pics

# Set the master permissions on these empty directories before we start moving files in
cd /home/plexmedia

# Set the ownership (you own, but share with Plex)
chown -R myname .
chgrp -R plex .

# Set the permissions we want
find . -type d -exec chmod 755 {} \;

# Lastly,  we set it to self perpetuate (each directory gets the flag which will be inherited as it grows)
find . -type d -exec chmod g+s {} \;

Now, as a test & demonstration, cp -r something into that area
Do the la -la

You’ll see You own it but Plex is the group member.

Speaking to your home directory,
if in /home/myname, you don’t have a .profile* file, you can create one
in it you can add the umask 022 line all by itself.

If in doubt, google how to do this. It’s part of the simpler admin skills you should have mastered at the command line.

1 Like

Thanks.

So I don’t need to set up “-exec chmod” for the files in \home\plexmedia?

Sorry, when you kept mentioning .profile, I was thinking something like a plex.profile type file (which is why I couldn’t fine it), not a \home\myname hidden file. My bad.

1 Like

No. Once the initial directories are set, it will maintain itself.

Here is the full How-To, You can see it in action.

Thanks, I DID read through your guide and it helped a lot. But I guess it doesn’t work as well when you have the plex media folder under your \home\myname folder.

I’m working on moving everything over to \home\plexmedia. If I have any troubles after the move, I’ll let you know but I guess you can mark this Solved.

Thanks again for all your help.

That’s right. When under your /home directory, other rules apply because of the Desktop manager.

Still having issues.

I went back through your guide and applied the commands to my new /home/plexmedia folder and newly moved files are still showing up as 600 instead of 644.

Suggestions?

Can you show me a directory listings (ls -la /home/plexmedia) please?

copy paste it here using

```
paste
listing
here
```

and it will show perfectly.

Blockquote
$ ls -la /home/plexmedia
total 268
drwxr-sr-x 11 clay plex 4096 Jun 21 13:34 .
drwxr-xr-x 4 root root 4096 Jun 19 17:40 …
drwxr-sr-x 2 clay plex 4096 Jun 22 17:00 movies
drwxr-sr-x 2 clay plex 65536 Jun 19 23:11 music
drwxr-sr-x 2 clay plex 4096 Jun 19 17:40 pictures
drwxr-sr-x 2 clay plex 86016 Jun 21 14:24 stuff2
drwxr-sr-x 2 clay plex 20480 Jun 19 18:14 stuff3
drwxr-sr-x 2 clay plex 4096 Jun 19 18:14 stuff4
drwxr-sr-x 2 clay plex 12288 Jun 19 18:15 stuff5
drwxr-sr-x 2 clay plex 61440 Jun 21 13:49 stuff6
drwxr-sr-x 42 clay plex 4096 Jun 22 15:35 tvshows