Jump to content

File Permissions Guide for New Linux Users


thefirstofthe300
Go to solution Solved by Richard Branches,

Recommended Posts

thefirstofthe300

This post is aimed at brand new users who need help setting the file permissions so that Emby can access your media.

 

File permissions for Linux native filesystems

 

The first thing you need to understand is how Linux determines the file permissions for any file on a compatible file system, e.g. ext4, ext3, xfs, btrfs, etc.  You can view the current file permissions by typing

ls -l /path/to/media

Doing so should leave you with output like

drwxr-xr-x. 2 emby users 4096 Dec 22 23:05 Transporter 3 (2008)
drwxrwxr-x. 2 emby users 4096 Dec 22 23:09 Transporter, The (2002)
drwxrwxr-x. 2 emby users 4096 Dec 22 23:03 Van Helsing (2004)
drwxr-xr-x. 2 emby users 4096 Dec 22 23:01 Veronica Mars (2014)
drwxrwxr-x. 2 emby users 4096 Dec 22 23:11 V for Vendetta (2005)
drwxr-xr-x. 2 emby users 4096 Dec 22 23:12 WALL·E (2008)
drwxr-xr-x. 2 emby users 4096 Dec 22 23:10 Whiplash (2014)

The first column gives you the file permissions as they are right now.  Let's break it down: there will always be ten letters possibly mixed with dashes in the column.

 

The first letter/dash denotes whether that item is a directory or not.  The next nine letters will always be a combination of rwx and dashes and tell you the read, write, and execute permissions for the owner, the group, and others.

 

Now let's break down the example give above, specifically Veronica Mars (2014).  As you can see by the first letter in the first column, the d, the item is a directory.  The next three letters as you already know set the permissions for the owner.  In this case, rwx means the owner has read, write, and execute permissions.  The next three letters/dashes tell you the permissions for the group.  r-x means that group has read permissions and execute permissions on the directory.  The last three letters are also r-x and mean that everyone who doesn't either own the file or belong to the group that owns it has read and execute permissions to the file.

 

The user who owns the file will be the third column from the left.  In the examples above, the files are all owned by the emby user.  The group that owns the file will be the fourth column from the left.  Again, in the examples above, the files are owned by the group users.

 

WORD OF CAUTION: execute permissions are a bit tricky to see as the execute permission for a directory means it can be opened by a anyone who has the execute permission.  For a file, the execute permission means that the file can execute code (potentially dangerous if you don't know for sure that the file is safe).  Generally, as long as you are keeping your system up to date and don't randomly type in your sudo password to a file that is execting it is extremely difficult for a virus to get onto your system.

 

File permissions for NTFS and other Windows based filesystems

 

NTFS has limitations on Linux because of the way that Windows handles file permissions.  Consequently, when an NTFS drive is mounted, the user must decide who owns ALL of the files on the drive.

 

If you are mounting the NTFS drive via the fstab, you can set the file permissions by adding rw,uid=username,gid=groupname to the mount options.  For NTFS drives that will never be unplugged from the computer, this is the preferred method to mount the drive.

 

If you are mounting the drive using the auto-mounting provided by the distro, you will need to add rw,uid=username,gid=groupname to the mount options for the auto-mounter.  In Gnome, this can be accomplished via Disks.  I am unsure about KDE (anyone willing to let me know, please do so).

 

 

WORD OF CAUTION: all drives in the fstab MUST be available to the system at all times.  If a drive is in the fstab but not available at boot, the boot sequence will drop to a rescue shell.

  • Like 2
Link to comment
Share on other sites

  • 2 months later...
georgeberz

I do not understand...

 

I have just set up ubuntu 16.04 lts and the current emby instructions for 15.10 here https://software.opensuse.org/download.html?project=home%3Aemby&package=emby-server

 

I have a folder on my desktop plus a folder on a usb external 5.0 TB hard disk called test plus another external usb 2.0 TB formatted ext4.

 

By default as installed emby will see the drive but not open up the folder.

 

It lets you go all the way to add you see the external hard disk and then it will not see any folders or files.

 

I am assuming it is a permissions error. I am not familiar with groups or linux and do not fully understand the terminal mode and prefer the GUI but some things have to be done at the termainal

 

Also I understand that the system creates a emby system user that I cannot edit permissions in the gui.

 

So can someone tell me a way to make this work?

 

Is it better to upgrade the status of the hidden emby system account or open up the drives to anybody? I want to remain relatively secure I have 4 boys in the house and they probe the network etc. I need to keep them from doing harm to our dvd image library.

 

I looked at the pinned notes and under installation instructions posted by LUKE are very vague and don't tell exactly how to install.

I need a idiots guide, perhaps someone should make a idiots guide. Nowhere in the instructions are modifying cryptic linux commands. It is very confusing.

 

Please help.

 

George

 

Link to comment
Share on other sites

thefirstofthe300

First off, what are the permissions for the folders located on the drives can't see? Command should be

 

ls -l /path/to/folder

 

Also, what is the output of

 

groups emby

 

Sent from my Nexus 5X using Tapatalk

Edited by thefirstofthe300
Link to comment
Share on other sites

georgeberz

First off, what are the permissions for the folders located on the drives can't see? Command should be

 

ls -l /path/to/folder

 

Also, what is the output of

 

groups emby

 

Sent from my Nexus 5X using Tapatalk

media@mediaserver:~$ ls -l '/media/media/test ext4'

total 36

drwxrwxrwx 2 media emby 16384 May  7 16:14 lost+found

drwxrwxrwx 6 media emby 20480 May  8 11:34 Specials - Info

 

media@mediaserver:~$ groups emby

emby : emby

 

 

 

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...
alewian

Hello. Thank you for the explanation. I understand well how permissions work in a Linux system. However, what are the recommended permissions, owner and group for the libraries files in order emby to work well with them?

  • Like 2
Link to comment
Share on other sites

  • 2 months later...
  • 4 months later...
morpheus1

This post is aimed at brand new users who need help setting the file permissions so that Emby can access your media.

 

File permissions for Linux native filesystems

 

The first thing you need to understand is how Linux determines the file permissions for any file on a compatible file system, e.g. ext4, ext3, xfs, btrfs, etc.  You can view the current file permissions by typing

ls -l /path/to/media

Doing so should leave you with output like

drwxr-xr-x. 2 emby users 4096 Dec 22 23:05 Transporter 3 (2008)
drwxrwxr-x. 2 emby users 4096 Dec 22 23:09 Transporter, The (2002)
drwxrwxr-x. 2 emby users 4096 Dec 22 23:03 Van Helsing (2004)
drwxr-xr-x. 2 emby users 4096 Dec 22 23:01 Veronica Mars (2014)
drwxrwxr-x. 2 emby users 4096 Dec 22 23:11 V for Vendetta (2005)
drwxr-xr-x. 2 emby users 4096 Dec 22 23:12 WALL·E (2008)
drwxr-xr-x. 2 emby users 4096 Dec 22 23:10 Whiplash (2014)

The first column gives you the file permissions as they are right now.  Let's break it down: there will always be ten letters possibly mixed with dashes in the column.

 

The first letter/dash denotes whether that item is a directory or not.  The next nine letters will always be a combination of rwx and dashes and tell you the read, write, and execute permissions for the owner, the group, and others.

 

Now let's break down the example give above, specifically Veronica Mars (2014).  As you can see by the first letter in the first column, the d, the item is a directory.  The next three letters as you already know set the permissions for the owner.  In this case, rwx means the owner has read, write, and execute permissions.  The next three letters/dashes tell you the permissions for the group.  r-x means that group has read permissions and execute permissions on the directory.  The last three letters are also r-x and mean that everyone who doesn't either own the file or belong to the group that owns it has read and execute permissions to the file.

 

The user who owns the file will be the third column from the left.  In the examples above, the files are all owned by the emby user.  The group that owns the file will be the fourth column from the left.  Again, in the examples above, the files are owned by the group users.

 

WORD OF CAUTION: execute permissions are a bit tricky to see as the execute permission for a directory means it can be opened by a anyone who has the execute permission.  For a file, the execute permission means that the file can execute code (potentially dangerous if you don't know for sure that the file is safe).  Generally, as long as you are keeping your system up to date and don't randomly type in your sudo password to a file that is execting it is extremely difficult for a virus to get onto your system.

 

File permissions for NTFS and other Windows based filesystems

 

NTFS has limitations on Linux because of the way that Windows handles file permissions.  Consequently, when an NTFS drive is mounted, the user must decide who owns ALL of the files on the drive.

 

If you are mounting the NTFS drive via the fstab, you can set the file permissions by adding rw,uid=username,gid=groupname to the mount options.  For NTFS drives that will never be unplugged from the computer, this is the preferred method to mount the drive.

 

If you are mounting the drive using the auto-mounting provided by the distro, you will need to add rw,uid=username,gid=groupname to the mount options for the auto-mounter.  In Gnome, this can be accomplished via Disks.  I am unsure about KDE (anyone willing to let me know, please do so).

 

 

WORD OF CAUTION: all drives in the fstab MUST be available to the system at all times.  If a drive is in the fstab but not available at boot, the boot sequence will drop to a rescue shell.

@@thefirstofthe300 you have done a great job in explaining the details of file permissions. But you can help also in showing how this could be safely done. I think you know what the problems are with adding folders, can you show how you actually do it; what commands you ran, etc, where and how. Thanks for the great details on file permissions, now I know what all those x and r mean.

Link to comment
Share on other sites

  • 5 months later...
fbm224

For the ones having trouble adding folders from an ntfs partition, on ubuntu 16.04 / mint 18 you may want to try this:

 

With the Disks utility, on the mounting options, switch the automatic mounting options, and select mount on startup. Then after reboot try adding again the ntfs folder, but keep in mind that it is mounted now on /mnt/ instead of /media/user/ 

 

Please note I have no idea why this works. 

  • Thanks 1
Link to comment
Share on other sites

  • 3 months later...
ebirman77

Hello.

 

I am cautious. As long as I keep the option “Save artwork and metadata into media folders” disabled, do I really need to grant write permissions to emby on my music library directories or just read and access permissions would be enough?

Link to comment
Share on other sites

Hello.

 

I am cautious. As long as I keep the option “Save artwork and metadata into media folders” disabled, do I really need to grant write permissions to emby on my music library directories or just read and access permissions would be enough?

 

No you don't. Read permissions will be fine. Let us know if this helps. Thanks.

  • Like 1
Link to comment
Share on other sites

  • 11 months later...
tdiguy

Hello.

 

I am cautious. As long as I keep the option “Save artwork and metadata into media folders” disabled, do I really need to grant write permissions to emby on my music library directories or just read and access permissions would be enough?

If it's currently working no need to change. Course without write permission emby cant delete something if you want to from within emby, course maybe that's your whole point of only giving emby read and execute.

 

Sent from my moto g(6) play using Tapatalk

Link to comment
Share on other sites

  • 3 months later...
reccomsa

por favor necesito agregar un disco duro a ubuntu ya esta instalado y dado el formato en ubuntu pero cuando quiero agregar una carpeta en emby me dice que tengo que darle permiso de lectura y escritura hay es cuando tengo el problema ya que al buscar la dirección en ubuntu y quiero ingresar en la carpeta se me hace rojo unas lineas y no me deja seleccionar el disco solo el disco principal pero no el secundario ayudaaaaa por favor  

Link to comment
Share on other sites

por favor necesito agregar un disco duro a ubuntu ya esta instalado y dado el formato en ubuntu pero cuando quiero agregar una carpeta en emby me dice que tengo que darle permiso de lectura y escritura hay es cuando tengo el problema ya que al buscar la dirección en ubuntu y quiero ingresar en la carpeta se me hace rojo unas lineas y no me deja seleccionar el disco solo el disco principal pero no el secundario ayudaaaaa por favor  

 

@@reccomsa

 

Hola, ¿dónde exactamente estás tratando de agregar la carpeta? ¿Puedes mostrar una captura de pantalla? Gracias !

Link to comment
Share on other sites

  • 4 months later...
Richard Branches

@@mastrmind11

I'm lost, I still don't see how to give Emby permission to access the "Music" folder located inside the home folder... any help?

Link to comment
Share on other sites

mastrmind11

@@mastrmind11

I'm lost, I still don't see how to give Emby permission to access the "Music" folder located inside the home folder... any help?

well, what do you mean by 'home folder' and what are the current permissions on the folder?  navigate to the folder via the command line and paste the output of

 ls -l 
Link to comment
Share on other sites

  • Solution
Richard Branches
On 6/11/2019 at 5:58 AM, mastrmind11 said:

 

well, what do you mean by 'home folder' and what are the current permissions on the folder?  navigate to the folder via the command line and paste the output of

 ls -l 

 

I apoligize for my late reply, I ran this command and I am now able to grant "read" and "write" access to the home folder with all its subfolders:

 

setfacl -m user:emby:rxw /home/myusername

 

or to grant "read only" access to specific folders:

 

setfacl -m user:emby:rx /home/myusername/Music

 
setfacl -m user:emby:rx /home/myusername/Videos
 
setfacl -m user:emby:rx /home/myusername/Pictures
 
Since Live TV must be read and written, then it's neccesary to grant "read" and "write" permissions:
 
setfacl -m user:emby:rxw /home/myusername/LiveTV
Edited by Richard Branches
  • Like 5
Link to comment
Share on other sites

Richard Branches

Thanks for the feedback !

 

You're welcome!, hope it helps other newbie Linux users.

Link to comment
Share on other sites

  • 4 months later...
shpankey

media@mediaserver:~$ ls -l '/media/media/test ext4'

total 36

drwxrwxrwx 2 media emby 16384 May  7 16:14 lost+found

drwxrwxrwx 6 media emby 20480 May  8 11:34 Specials - Info

 

media@mediaserver:~$ groups emby

emby : emby

 

 

Did someone ever provide an answer for georgeberz on this and his previous post? I have a friend I've convinced to switch to Emby and he's having this same issue. Using Ubuntu 18.04 and cannot get Emby to read his external drives. Any help (a step by step guide would be preferable). We spent a couple hours on this today, using the (very little and vague) info provided.

Edited by shpankey
Link to comment
Share on other sites

Stlk filmes

I already got it, I used this form and it worked!

 

sudo rclone mount equipe: /mnt/emby  --umask=000 --vfs-cache-mode writes  --allow-other

 

change only what is bold, (team) will be the name of the drive, and (emby) name of the folder where the files are

Link to comment
Share on other sites

Stlk filmes

Did someone ever provide an answer for georgeberz on this and his previous post? I have a friend I've convinced to switch to Emby and he's having this same issue. Using Ubuntu 18.04 and cannot get Emby to read his external drives. Any help (a step by step guide would be preferable). We spent a couple hours on this today, using the (very little and vague) info provided.

don't forget to create folders in mkdir / mnt / emby

 

sudo rclone mount equipe: /mnt/emby  --umask=000 --vfs-cache-mode writes  --allow-other

 

change only what is bold, (team) will be the name of the drive, and (emby) name of the folder where the files are

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...