Jump to content

File Permissions Guide for New Linux Users


thefirstofthe300
Go to solution Solved by Richard Branches,

Recommended Posts

vdrover

I was struggling with permissions on Ubuntu. After a lot of experimenting, the key was to set the following default ACL rule recursively on my external drive:

`sudo setfacl -R --default --modify u:emby:rwx '/mnt/Emby'
Link to comment
Share on other sites

  • 3 months later...

Please help me out. My emby server has been running for well over 2 months. I had absolutely no issues. I had a issue on the weekend for some reason nzbget unpackages extremly slow so i thought hey maybe i can fix it in the end i screwed up nzbget but got it working 2 days after the screww up. Now suddenly when theres a movie thats finished it wont scan the folder  for that movie and update my library. So I checked the logs and im getting a error diskstate error and cant write to the /var/mnt/movies.

So i Looked everywhere come up with permission errors but how did the permissions just decide to change.
I thought hell im a bit more clued up my radarr, sonarr and nzbget is working awesome i have them in a group called media, Im just gonna move the emby user to that group. It didnt resolve my issue tho. Can anyone give me some advice on how to give proper rights for that group for the movie harddrive?

And can anyone give me advice onto why Unrar is so extremly slow on a 8gig file? If i mean slow 8 gigs will extract in 2 hrs.
Can it be a partition issue? NTFS

Link to comment
Share on other sites

Q-Droid
7 hours ago, Mince said:

Please help me out. My emby server has been running for well over 2 months. I had absolutely no issues. I had a issue on the weekend for some reason nzbget unpackages extremly slow so i thought hey maybe i can fix it in the end i screwed up nzbget but got it working 2 days after the screww up. Now suddenly when theres a movie thats finished it wont scan the folder  for that movie and update my library. So I checked the logs and im getting a error diskstate error and cant write to the /var/mnt/movies.

So i Looked everywhere come up with permission errors but how did the permissions just decide to change.
I thought hell im a bit more clued up my radarr, sonarr and nzbget is working awesome i have them in a group called media, Im just gonna move the emby user to that group. It didnt resolve my issue tho. Can anyone give me some advice on how to give proper rights for that group for the movie harddrive?

And can anyone give me advice onto why Unrar is so extremly slow on a 8gig file? If i mean slow 8 gigs will extract in 2 hrs.
Can it be a partition issue? NTFS

Starting with the last - some files come damaged. Some come extremely damaged and can take a while to repair and extract. Is 2 hrs too long for 8GB? I couldn't say since for all we know you could be running this on a Casio watch because you didn't post enough info.

You broke nzbget, then "fixed" it. How? We don't know, you didn't say.

You get errors in the logs. Which logs? We don't know, you didn't say.

You might need to restore group membership, permissions or something else to a previous state. Which ones? We don't know, there's no info on the previous or current state.

FFS people...help others help you.

You might be on the right track with the common group membership but if it wasn't there before you have a different issue. It's still a good approach for integration.

I need to get my coffee...

P.S. - A useful setting in nzbget is "UnrarCmd: ${AppDir}/unrar x -ai" so that any weird permissions within the archives are ignored and reset upon extraction.

 

Link to comment
Share on other sites

2 hours ago, Q-Droid said:

Starting with the last - some files come damaged. Some come extremely damaged and can take a while to repair and extract. Is 2 hrs too long for 8GB? I couldn't say since for all we know you could be running this on a Casio watch because you didn't post enough info.

You broke nzbget, then "fixed" it. How? We don't know, you didn't say.

You get errors in the logs. Which logs? We don't know, you didn't say.

You might need to restore group membership, permissions or something else to a previous state. Which ones? We don't know, there's no info on the previous or current state.

FFS people...help others help you.

You might be on the right track with the common group membership but if it wasn't there before you have a different issue. It's still a good approach for integration.

I need to get my coffee...

P.S. - A useful setting in nzbget is "UnrarCmd: ${AppDir}/unrar x -ai" so that any weird permissions within the archives are ignored and reset upon extraction.

 

The same machine had another operating system on also with nzbget and rar was done in about 5-10min so its not the machine

Nzbget i tried to fix the rar issue. So i added a path for unrar and just after i added the path the whole nzbget webgui went down. At the end i reinstalled Nzbget.

 

Link to comment
Share on other sites

Q-Droid
6 hours ago, Mince said:

The same machine had another operating system on also with nzbget and rar was done in about 5-10min so its not the machine

Nzbget i tried to fix the rar issue. So i added a path for unrar and just after i added the path the whole nzbget webgui went down. At the end i reinstalled Nzbget.

 

After the reinstall you've run into problems with access to a path: /var/mnt/movies. Is this the problem you have now?

Which application can't access that path, Emby or nzbget? Which log files have errors? Can you attach the logs or post the errors?

You mentioned the *arr's. Is radarr handling the movie after download, moving it from nzbget destination into the library or is nzbget unpacking directly into the library?

 

Link to comment
Share on other sites

  • 2 weeks later...
Mince
On 4/21/2022 at 11:19 PM, Q-Droid said:

After the reinstall, you've run into problems with access to a path: /var/mnt/movies. Is this the problem you have now?

Which application can't access that path, Emby or nzbget? Which log files have errors? Can you attach the logs or post the errors?

You mentioned the *arr's. Is radar handling the movie after download, moving it from nzbget destination into the library, or is nzbget unpacking directly into the library?

 

I got it sorted thx
So the initial drive had an input-output error I couldn't fix it on Linux. I took out the drive and installed it on my windows machine. When I opened the drive there was a permissions error opened it as admin and backed up my directory. Installed it back into the Linux machine. Formatted the drive with a Linux partition. Put the old directory in place.

Unrar is working now extracting in 8min on an 8gig file. My conclusion looks like NTFS file system was an issue. input output error is also gone. Emby is syncing as well now

  • Thanks 1
Link to comment
Share on other sites

  • 2 months later...
jim3211

on ubuntu 20.04 

give emby ownership of usb drives

sudo chown -R emby:emby /media/jim/    ....where my usb disks mount...
 
add user to group to use drives as your user
 
sudo usermod -a -G emby jim                                                 ..... add my user to group to have access to drives.....
 
log out,log in to take effect or reboot
hope this helps
Edited by jim3211
Link to comment
Share on other sites

  • 1 month later...

Probably I have wasted too much time trying to make Emby work from my Raspberry Pi with attached NFTS hard drive that is automounted but I will give it one more try.  The file permissions on the hard drive (named Elements) are drxwrwxrwx.  The user name that I added is emby.  But every time I try to add a folder to the library I get the error message "The path could not be found. Please ensure the path is valid and try again."

Should I just give up?

Link to comment
Share on other sites

  • 3 weeks later...
On 8/20/2022 at 6:16 PM, DSMDSM said:

Probably I have wasted too much time trying to make Emby work from my Raspberry Pi with attached NFTS hard drive that is automounted but I will give it one more try.  The file permissions on the hard drive (named Elements) are drxwrwxrwx.  The user name that I added is emby.  But every time I try to add a folder to the library I get the error message "The path could not be found. Please ensure the path is valid and try again."

Should I just give up?

Did u come right with your issue?

Link to comment
Share on other sites

  • 5 months later...
tedfroop

So just to ask stupid questions.......

My new box I just set up - is set up with two mount points for my media hard drives.  One set of mount points has rights that makes Logitech Media Server (Squeezeboxes) happy and one that makes Emby happy for rights.  Both sets mount from the F-stab at boot. Files on my media drive are all set to owner Nobody and No Group.  

Should be all good?  Everybody is happy and everything works perfectly now.

 

  • Thanks 1
Link to comment
Share on other sites

  • 2 months later...
Learning_Curve

I don't understand why this is so convoluted.

Why is adding user emby to my [username] group not enough to give it full access to read/write/delete files in my libraries, which i own and have full access to?

Why do I have to change ownership of the libraries to emby:emby in order for it to work? Which then causes problems for me and any other services that may be running?

Why are my other services able to freely read/write/add to/delete from all the same libraries without jumping through any hoops?

 

Sorry for ranting, but this is all just so bizarre, and there's no good reason that can think of for it to be this way.

When I cat /etc/passwd, there is no user 'emby'. Is that what's wrong or what?

1.png

2.png

3.png

4.png

5.png

Link to comment
Share on other sites

Q-Droid
4 hours ago, Learning_Curve said:

I don't understand why this is so convoluted.

Why is adding user emby to my [username] group not enough to give it full access to read/write/delete files in my libraries, which i own and have full access to?

Why do I have to change ownership of the libraries to emby:emby in order for it to work? Which then causes problems for me and any other services that may be running?

Why are my other services able to freely read/write/add to/delete from all the same libraries without jumping through any hoops?

 

Sorry for ranting, but this is all just so bizarre, and there's no good reason that can think of for it to be this way.

When I cat /etc/passwd, there is no user 'emby'. Is that what's wrong or what?

 

It might be a little complex but not convoluted. This is standard UNIX/Linux file access controls and not something the Emby is doing. It's just an application running on Linux following the OS rules.

If you didn't have a user and group emby then they would not show up as such in the listings. You would see UID and GID as owners instead.

What Linux distro are you using?

Link to comment
Share on other sites

Learning_Curve
3 minutes ago, Q-Droid said:

It's just an application running on Linux following the OS rules.

Maybe. Strange that my torrent program didn't need any special massaging to access the folder it works out of. Sickchill didn't need any help to read, write, create or delete files inside some of the same folders emby works out of.

5 minutes ago, Q-Droid said:

What Linux distro are you using?

Manjaro.

Link to comment
Share on other sites

Q-Droid

It depends on what OS users run those applications.

Manjaro is Arch based so you might need to read their guide for Emby. There are specific steps for Emby on Arch because of their use of DynamicUser in systemd. This might be what you're running into but I can't be sure because I don't use either.

https://wiki.archlinux.org/title/Emby

There is also this thread.

 

 

Link to comment
Share on other sites

  • 4 months later...

Probably a silly question but I am brand new to debian and those permissions are confusing me.

I have installed emby through docker (not sure if relevant...).

I want to access the media folder /mnt/raid1/videos/movies but beyond "mnt" emby doesn't see anything (and won't let me type it either).

I assume it's a permission issue, but I made 777 on raid1 (yeah I know, shouldn't) and it didn't help. Also : I don't seem to have an emby user.

What should I do ?

Link to comment
Share on other sites

Q-Droid
35 minutes ago, Hairlock said:

Probably a silly question but I am brand new to debian and those permissions are confusing me.

I have installed emby through docker (not sure if relevant...).

I want to access the media folder /mnt/raid1/videos/movies but beyond "mnt" emby doesn't see anything (and won't let me type it either).

I assume it's a permission issue, but I made 777 on raid1 (yeah I know, shouldn't) and it didn't help. Also : I don't seem to have an emby user.

What should I do ?

At a high level this is what I think you should do:
1. You'll have to decide how you want to manage the media. Which user creates and owns the files. If for example you want to use your own Debian user account to create, copy, move media files then skip step 2 and instead use your UID and GID for step 4 (as long as it's not root). Things are easier when the media owner matches the emby server runtime user.
2. On your host OS create a user emby and group emby (with user emby as a member). Make note of the UID and GID.
3. Make sure the permissions for /mnt/raid1/videos/movies are at least 755 for each directory in the path.

This means:
drwxr-xr-x (755)    /mnt         
drwxr-xr-x (755)    /mnt/raid1
drwxr-xr-x (755)    /mnt/raid1/videos
drwxr-xr-x (755)    /mnt/raid1/videos/movies

4. Use the emby (or chosen user's) UID and GID in the docker compose or run command or portainer settings.
5. You may or may not have to change ownership of the Emby container config path. The container creation might take care of this, I can't remember.
6. If the user from step 4 (UID/GID) is not the owner of the media then you might have to change ownership and/or permissions so that the Emby server can access/create/delete files and directories in the library.

My preference is to create dedicated service accounts for the applications I run on my servers, whether in Docker or not. But for some it's easier to use their own accounts which already own the media files in their libraries. It simplifies access and maintenance for those who are new or less familiar.
 

  • Thanks 1
Link to comment
Share on other sites

docker run -d \
  --name=emby \
  -e PUID=1001 \
  -e PGID=1001 \
  -e TZ=Etc/UTC \
  -p 8096:8096 \
  -p 8920:8920 `#optional` \
  -v /mnt/raid1/:/config \
  -v /opt/vc/lib:/opt/vc/lib `#optional` \
  --restart unless-stopped \
  lscr.io/linuxserver/emby:latest

I assume I made bad choices when picking this from dockerhub, how can I edit that stuff after the fact ?

Edited by Hairlock
Link to comment
Share on other sites

Q-Droid

Yep. With this compose your media will be under /config/videos in Emby. Everything will be under /config as it is now. It's up to you to decide if this is good enough or if you want to reorganize to change it.

 

 

 

  • Thanks 1
Link to comment
Share on other sites

I have changed my compose file, now I understand that I have to tell emby that the folder is data/movies, and not tell him mnt/raid1/videos...

 


---
version: "2.1"
services:
  emby:
    image: lscr.io/linuxserver/emby:latest
    container_name: emby
    environment:
      - PUID=1001
      - PGID=1001
      - TZ=Etc/UTC
    volumes:
      - /mnt/raid1/library:/config
      - /mnt/raid1/videos/series:/data/tvshows
      - /mnt/raid1/videos/movies:/data/movies
    ports:
      - 8096:8096
      - 8920:8920 #optional
    devices:
      - /dev/dri:/dev/dri #optional
    restart: unless-stopped

 

Link to comment
Share on other sites

Q-Droid

Right. And going forward if you plan to add media type directories it might be simpler to use:

- /mnt/raid1/videos:/data

Or reorganize a bit and do:

- /mnt/raid1/media:/media

Unless there are other directories under videos you want to keep hidden from Emby.

 

Edited by Q-Droid
Link to comment
Share on other sites

jaycedk

I think it would be a good idea to put his config in a specific library

Its now

- /mnt/raid1/library:/config

Could be

- /mnt/raid1/library/Emby-server:/config

  • Like 1
Link to comment
Share on other sites

So to make that change I just edit the docker compose file and reprocess it through docker, correct ?

then delete the extra stuff left behind (if any) ?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...