Jump to content


Photo

File Permissions Guide for New Linux Users


  • Please log in to reply
11 replies to this topic

#1 thefirstofthe300 OFFLINE  

thefirstofthe300

    Linux Geek

  • Members
  • 1323 posts
  • Local time: 04:34 PM
  • LocationEastern Oregon

Posted 04 March 2016 - 04:52 PM

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.


  • hurricanehrndz and Cavemantech13 like this

#2 georgeberz OFFLINE  

georgeberz

    Member

  • Members
  • 11 posts
  • Local time: 04:34 PM

Posted 08 May 2016 - 03:30 PM

I do not understand...

 

I have just set up ubuntu 16.04 lts and the current emby instructions for 15.10 here https://software.ope...age=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

 



#3 thefirstofthe300 OFFLINE  

thefirstofthe300

    Linux Geek

  • Members
  • 1323 posts
  • Local time: 04:34 PM
  • LocationEastern Oregon

Posted 10 May 2016 - 10:48 AM

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, 10 May 2016 - 10:51 AM.


#4 georgeberz OFFLINE  

georgeberz

    Member

  • Members
  • 11 posts
  • Local time: 04:34 PM

Posted 10 May 2016 - 03:36 PM

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


 



#5 siow OFFLINE  

siow

    Newbie

  • Members
  • 1 posts
  • Local time: 08:34 PM

Posted 27 May 2016 - 10:55 AM

Onde dou as permissões para carregar os filmes no Ubuntu?



#6 alewian OFFLINE  

alewian

    Newbie

  • Members
  • 3 posts
  • Local time: 12:34 AM

Posted 02 July 2016 - 06:19 AM

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?


  • ebirman77 likes this

#7 dcrdev OFFLINE  

dcrdev

    Advanced Member

  • Members
  • 846 posts
  • Local time: 12:34 AM
  • LocationUK

Posted 17 September 2016 - 09:57 PM

Removed.


Edited by dcrdev, 15 November 2017 - 05:43 AM.


#8 morpheus1 OFFLINE  

morpheus1

    Advanced Member

  • Members
  • 36 posts
  • Local time: 12:34 AM

Posted 03 February 2017 - 06:46 PM

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.



#9 fbm224 OFFLINE  

fbm224

    Newbie

  • Members
  • 9 posts
  • Local time: 06:34 PM

Posted 31 July 2017 - 04:51 PM

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. 



#10 ebirman77 OFFLINE  

ebirman77

    Member

  • Members
  • 15 posts
  • Local time: 08:34 PM

Posted 04 November 2017 - 03:29 PM

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?



#11 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 105979 posts
  • Local time: 06:34 PM

Posted 04 November 2017 - 09:06 PM

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.


  • ebirman77 likes this

#12 tdiguy OFFLINE  

tdiguy

    Advanced Member

  • Members
  • 1045 posts
  • Local time: 06:34 PM

Posted 09 October 2018 - 08:13 AM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users