Jump to content

File Permissions Guide for New Linux Users


thefirstofthe300
Go to solution Solved by Richard Branches,

Recommended Posts

hello all

 

iam having a issue with my set up and i have been digging around for hours now and i just cant come right.

 

iam ruing opensuse leap kde plasma verson 5.12.8

 

i have installed emby and it has a user named emby

when i go to add the drive in the library i can not see the hdd and i have connected internally on my system

the mounting point is

 

  • /run/media/username/

 

in yast2 partioner device is /dev/sdb1

 

the output for

 

ls -l /run/media/username/
total 4
drwxrwxrwx 1 atlantica users 4096 Jan 12  2019 Samsung 2TBINT

 

in yast partitioner if i click on the drive and go to edit i get a fstab options in those options is this "rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096"

 

i hope that this all makes sence ... i was busy trying to take screenshots of everything but apparently that didnt work either , so had to try and type it all out and hoping i have entered in all the information that you need in order to help me.

 

i dont understand why i cant get it working because as a test before i had everything working on a different release of opensuse gnome i think not sure now.

 

but now that iam ready to nail down everything iam stuck again

 

anyway thank you for the help
 

 

Link to comment
Share on other sites

  • 2 weeks later...
mastrmind11

hello all

 

iam having a issue with my set up and i have been digging around for hours now and i just cant come right.

 

iam ruing opensuse leap kde plasma verson 5.12.8

 

i have installed emby and it has a user named emby

when i go to add the drive in the library i can not see the hdd and i have connected internally on my system

the mounting point is

 

  • /run/media/username/

 

in yast2 partioner device is /dev/sdb1

 

the output for

 

ls -l /run/media/username/

total 4

drwxrwxrwx 1 atlantica users 4096 Jan 12  2019 Samsung 2TBINT

 

in yast partitioner if i click on the drive and go to edit i get a fstab options in those options is this "rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096"

 

i hope that this all makes sence ... i was busy trying to take screenshots of everything but apparently that didnt work either , so had to try and type it all out and hoping i have entered in all the information that you need in order to help me.

 

i dont understand why i cant get it working because as a test before i had everything working on a different release of opensuse gnome i think not sure now.

 

but now that iam ready to nail down everything iam stuck again

 

anyway thank you for the help

 

because you're mounting the drive as root/root (the 0,0 part of the command).  You need to mount it as a user and/or group that emby has access to.  You need to find out which id emby has on your system and use that, or add emby to a group and then use that group_id.  ALso, fyi the whole default_permission thing only gives the user rw access and the group just r, so if you plan to let emby do any metadata storing on that drive and you're not planning to set the user_id to whatever emby is, it won't work.  Plenty of info about fstab online, and the man pages are pretty easy to follow https://help.ubuntu.com/community/Fstab

Link to comment
Share on other sites

ok so i get this

 

 

linux-dxpa:~ # sudo blkid
/dev/sda2: UUID="74e11220-b4eb-409f-9b63-d7a96e68ab93" UUID_SUB="b1bfcc6b-e388-4c51-a328-6785c9c39423" TYPE="btrfs" PARTUUID="19271fdb-d3e1-4e4b-87be-d6e5b17c6fff"
/dev/sda3: UUID="abed5316-5e1d-4600-8db9-da1e15d717d5" TYPE="swap" PARTUUID="1e32dfa3-ec6f-46f4-bff6-c0c835f28163"
/dev/sdb1: LABEL="Samsung 2TBINT" UUID="7EF2C87AF2C83863" TYPE="ntfs" PTTYPE="atari" PARTUUID="60952cce-01"
/dev/sda1: PARTUUID="753d1e77-a026-42e5-a981-93c97582d7af"
 

 

 

linux-dxpa:~ # cat /etc/fstab
UUID=74e11220-b4eb-409f-9b63-d7a96e68ab93  /                       btrfs  defaults                      0  0
UUID=74e11220-b4eb-409f-9b63-d7a96e68ab93  /var                    btrfs  subvol=/@/var                 0  0
UUID=74e11220-b4eb-409f-9b63-d7a96e68ab93  /usr/local              btrfs  subvol=/@/usr/local           0  0
UUID=74e11220-b4eb-409f-9b63-d7a96e68ab93  /tmp                    btrfs  subvol=/@/tmp                 0  0
UUID=74e11220-b4eb-409f-9b63-d7a96e68ab93  /srv                    btrfs  subvol=/@/srv                 0  0
UUID=74e11220-b4eb-409f-9b63-d7a96e68ab93  /root                   btrfs  subvol=/@/root                0  0
UUID=74e11220-b4eb-409f-9b63-d7a96e68ab93  /opt                    btrfs  subvol=/@/opt                 0  0
UUID=74e11220-b4eb-409f-9b63-d7a96e68ab93  /home                   btrfs  subvol=/@/home                0  0
UUID=74e11220-b4eb-409f-9b63-d7a96e68ab93  /boot/grub2/x86_64-efi  btrfs  subvol=/@/boot/grub2/x86_64-efi  0  0
UUID=74e11220-b4eb-409f-9b63-d7a96e68ab93  /boot/grub2/i386-pc     btrfs  subvol=/@/boot/grub2/i386-pc  0  0
UUID=74e11220-b4eb-409f-9b63-d7a96e68ab93  /.snapshots             btrfs  subvol=/@/.snapshots          0  0
UUID=abed5316-5e1d-4600-8db9-da1e15d717d5  swap                    swap   defaults                      0  0
 

 

 

linux-dxpa:~ # sudo fdisk -l
Disk /dev/sda: 465.8 GiB, 500107862016 bytes, 976773168 sectors
Disk model: CT500MX500SSD1  
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: BC903D40-2244-46BE-B169-BC103FC37A4C

Device         Start       End   Sectors   Size Type
/dev/sda1       2048     18431     16384     8M BIOS boot
/dev/sda2      18432 972578815 972560384 463.8G Linux filesystem
/dev/sda3  972578816 976773134   4194319     2G Linux swap


Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Disk model: SAMSUNG HD204UI
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x60952cce

Device     Boot Start        End    Sectors  Size Id Type
/dev/sdb1        2048 3907026943 3907024896  1.8T  7 HPFS/NTFS/exFAT
 

 

 

 

Link to comment
Share on other sites

you need to follow what I said in my last post.

hi there sorry for the late reply ... took me a while to grasp what you said lol

i understand what you are saying after awhile but like iam at a lose on how to execute what i need to , iam getting so frustrated as i had it working before but i just can not recall what i did lmao.

Link to comment
Share on other sites

mastrmind11

hi there sorry for the late reply ... took me a while to grasp what you said lol

i understand what you are saying after awhile but like iam at a lose on how to execute what i need to , iam getting so frustrated as i had it working before but i just can not recall what i did lmao.

i literally told what you need to do.  change your fstab so you're not mounting the drive as root/root but instead emby/emby.  if you don't know the uid/gid for emby then google is nice:  https://www.carnaghan.com/knowledge-base/how-to-find-your-uiduserid-and-gidgroupid-in-linux-via-the-command-line/.  You also don't want default_permission in your fstab if you require emby to have write permission.  That's it.  Try it and come back if you get stuck, but you have to try first.

Link to comment
Share on other sites

Ok awesome thank you for finding that page , the search results I got were different but I can’t recall at the moment what they were. I will give this a good when I get back to the box

Link to comment
Share on other sites

  • 3 weeks later...
nevolex

Here is the guide for those who re struggling to get the permissions sorted for the backup plugin on linux: 

 

sudo apt-get install cifs-utils

 

--Authenticate to SMB Share using Credential File created in /var
 
sudo vim /var/credentials
username=SMB_username
password=SMB_password

 

 

---Mount the share with Emby R&W access to /mnt folder:
 
sudo mount -t cifs -o credentials=/var/credentials,uid=emby,gid=emby  //192.168.1.2/path/to/my/folder /mnt         
 
 
----To get the share auto mounted after restart edit fstab
 
sudo vim /etc/fstab
 
//192.168.1.2/path/to/my/folder /mnt/path/to/my/folder cifs uid=emby,gid=emby,credentials=/var/credentials 0 0
 
 
------reboot and test
Edited by nevolex
Link to comment
Share on other sites

  • 11 months later...
Przemek

Hello, I have Dietpi with Emby Server on Rpi4. I recently reinstall my Dietpi on new sd-card and copy /var/lib/emby and /opt/emby-server to new sd-card. Now when I install Emby-server everything is almost OK. I can download movies and series to my Emby (I use transmission, couchpotato and medusa from my ubuntu laptop). But there's mess with permissions. I cannot open some files and other works. Emby don't change titles (shows whole file names), don't download metadata.
I have Video folder with Movie and Series folders inside on my HDD connected to Dietpi.
Can somebody tell me how to make it wright?
regards,
Przemek

Edited by Przemek
Link to comment
Share on other sites

not sure if that would be useful to you but you can try to mound that external drive as smb share 

 

https://www.raspberrypi.org/forums/viewtopic.php?t=247963

 

then

#Install cifs-utils package 

sudo apt-get update
sudo apt-get install cifs-utils


Authenticate Samba Share using Credential File

sudo vim /var/credentials
add:

username=emby
password=random_pass

Mount it

sudo mount -t cifs -o vers=3.0,credentials=/var/credentials,uid=emby,gid=emby //10.10.0.5/Media /mnt    (path to media folder to be mounted to /mnt )


#Edit fstab

sudo vim /etc/fstab
add:

//10.10.0.5/Media /mnt/Media cifs vers=3.0,uid=emby,gid=emby,credentials=/var/credentials 0 0

reboot

Edited by nevolex
Link to comment
Share on other sites

Stlk filmes
Good night, for those who want to create a virtual disk, and add the emby library to all movie folders, contact me by email: borbadsa@bol.com.br
Link to comment
Share on other sites

Stlk filmes
1 hour ago, Przemek said:

Olá, tenho Dietpi com Emby Server em Rpi4. Recentemente, reinstalei meu Dietpi no novo cartão SD e copiei / var / lib / emby e / opt / emby-server para o novo cartão SD. Agora, quando eu instalo o Emby-server, está quase tudo OK. Posso baixar filmes e séries para o meu Emby (eu uso transmissão, couchpotato e medusa do meu laptop ubuntu). Mas há confusão com as permissões. Não consigo abrir alguns arquivos e outros trabalhos. Emby não muda títulos (mostra nomes de arquivos inteiros), não baixe metadados.
Tenho uma pasta de vídeo com pastas de filmes e séries em meu disco rígido conectado ao Dietpi.
Alguém pode me dizer como fazer isso certo?
Atenciosamente,
Przemek

Good night, for those who want to create a virtual disk, and add the emby library to all movie folders, contact me by email: borbadsa@bol.com.br
Link to comment
Share on other sites

Stlk filmes
1 hour ago, nevolex said:

não tenho certeza se isso seria útil para você, mas você pode tentar montar essa unidade externa como compartilhamento smb 

 

https://www.raspberrypi.org/forums/viewtopic.php?t=247963

 

então

#Install o pacote cifs-utils 

sudo apt-get update
sudo apt-get install cifs-utils


Autenticar compartilhamento Samba usando arquivo de credencial

sudo vim / var / credentials
add:

username
= emby password = random_pass

Monte

sudo mount -t cifs -o vers = 3.0, credentials = / var / credentials, uid = emby, gid = emby //10.10.0.5/Media / mnt (caminho para a pasta de mídia a ser montada em / mnt)


#Editar fstab

sudo vim / etc / fstab
add:

//10.10.0.5/Media / mnt / Media cifs vers = 3.0, uid = emby, gid = emby, credentials = / var / credentials 0 0

reiniciar

Good night, for those who want to create a virtual disk, and add the emby library to all movie folders, contact me by email: borbadsa@bol.com.br

Link to comment
Share on other sites

Przemek
23 hours ago, nevolex said:

not sure if that would be useful to you but you can try to mound that external drive as smb share 

 

https://www.raspberrypi.org/forums/viewtopic.php?t=247963

 

then

#Install cifs-utils package 

sudo apt-get update
sudo apt-get install cifs-utils


Authenticate Samba Share using Credential File

sudo vim /var/credentials
add:

username=emby
password=random_pass

Mount it

sudo mount -t cifs -o vers=3.0,credentials=/var/credentials,uid=emby,gid=emby //10.10.0.5/Media /mnt    (path to media folder to be mounted to /mnt )


#Edit fstab

sudo vim /etc/fstab
add:

//10.10.0.5/Media /mnt/Media cifs vers=3.0,uid=emby,gid=emby,credentials=/var/credentials 0 0

reboot

Hi @nevolex I have mounted my drive as NFS share and it works perfect. I don't like samba because many problems with that protocol. That config works perfect to me before I reinstall my Dietpi. I just looking for guide how to add permissions or emby user to groups?  

Edit. I must change some folders permissions in /var/lib/emby. Now it's OK.

Regards,
Przemek

 

Edited by Przemek
Link to comment
Share on other sites

Stlk filmes

 
Good night, for those who want to create a virtual disk, and add the emby library to all movie folders, contact me by email: borbadsa@bol.com.br

Link to comment
Share on other sites

Stlk filmes
11 hours ago, Przemek said:

Hi @nevolex I have mounted my drive as NFS share and it works perfect. I don't like samba because many problems with that protocol. That config works perfect to me before I reinstall my Dietpi. I just looking for guide how to add permissions or emby user to groups?  

Edit. I add emby user to dietpi group. I set everything for dietpi user and group [my Video and Series folders and files] but that doesn't help. I have strange situation here: my transmission can download movies and series snatched from Medusa and Couchpotato. For series Emby download posters and metadata but for movies not, Emby also don't change title for movies (shows full file name like Matrix_WEB-DL.x264[rarbg].mp4). I can play movies but cannot pay many series that works perfect before. When I try to download poster I search and I see nice poster but when I clik on it I see broken image icon and nothing happen when I download.
Also strange is I cannot play series but I can play movies 😐
Maybe @Luke can help me here?
 

Regards,
Przemek

embyserver.txt 3.53 MB · 0 downloads ffmpeg-transcode-15b96199-ce8b-4ab4-878f-b1b6195987ea_1.txt 10.77 kB · 0 downloads

Good night, for those who want to create a virtual disk, and add the emby library to all movie folders, contact me by email: borbadsa@bol.com.br

Link to comment
Share on other sites

On 12/9/2020 at 6:11 PM, Stlk filmes said:

 
Good night, for those who want to create a virtual disk, and add the emby library to all movie folders, contact me by email: borbadsa@bol.com.br

 

Hi could you help me out, I am  trying to give emby read and write access to my media folders. I tried adding: setfacl -m user:emby:rxw Movies, then I get setfacl: Option -m: Invalid argument near character 6.

Link to comment
Share on other sites

Stlk filmes
1 hour ago, Random9 said:

Olá, você poderia me ajudar, estou tentando fornecer acesso de leitura e gravação emby às minhas pastas de mídia. Tentei adicionar: setfacl -m user: emby: rxw Movies, então recebo setfacl: Opção -m: Argumento inválido próximo ao caractere 6.

my email: borbadsa@bol.com.br

Em 08/12/2020 às 19h29, a nevolex disse:

não tenho certeza se isso seria útil para você, mas você pode tentar montar essa unidade externa como compartilhamento smb 

 

https://www.raspberrypi.org/forums/viewtopic.php?t=247963

 

então

#Install o pacote cifs-utils 

sudo apt-get update
sudo apt-get install cifs-utils


Autenticar compartilhamento Samba usando arquivo de credencial

sudo vim / var / credentials
add:

username
= emby password = random_pass

Monte

sudo mount -t cifs -o vers = 3.0, credentials = / var / credentials, uid = emby, gid = emby //10.10.0.5/Media / mnt (caminho para a pasta de mídia a ser montada em / mnt)


#Editar fstab

sudo vim / etc / fstab
add:

//10.10.0.5/Media / mnt / Media cifs vers = 3.0, uid = emby, gid = emby, credentials = / var / credentials 0 0

reiniciar

 

Link to comment
Share on other sites

  • 5 months later...
Kodi_Newcomer
On 6/11/2019 at 3:56 PM, Richard Branches said:

 

I apoligize for my late reply, I run 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/LiveTV

But when i set this, all new added Folders and File by other user, have the same problem. I have to do this manual every time, new files are added ?

Link to comment
Share on other sites

Richard Branches
5 minutes ago, Kodi_Newcomer said:

But when i set this, all new added Folders and File by other user, have the same problem. I have to do this manual every time, new files are added ?

You shouldn't unless something else needs to be added to the syntax to include subfolders, I'll have to investigate since I'm not using Linux at the moment.

Link to comment
Share on other sites

Q-Droid
19 hours ago, Kodi_Newcomer said:

But when i set this, all new added Folders and File by other user, have the same problem. I have to do this manual every time, new files are added ?

Generally you need two things. You can omit the 'w' (rX) for read-only access but then stuff like adding metadata and subtitles can give you trouble.

Recursively add an ACL to give access to existing files and directories.

setfacl -R -m user:emby:rwX <path to media base dir>

Recursively add a default ACL rule that will automatically give access to new files and directories.

setfacl -R -m d:user:emby:rwX <path to media base dir>

This can be done in a single command but it's easier to explain with two.

 

Link to comment
Share on other sites

  • 3 months later...
mrfragger

for those using exfat external USB drives like I am..I spent countless hours in Linux Mint 20.2 (which is Ubuntu 20.04 basically)

trying to figure this out....thought it was gonna be so hard like veracrypt encryption mounting was...I added emby group to user, changed fstab, manually mounted...finally figured if I made a mount point just in /media like sudo mkdir /media/emby then it would work but if you do sudo mkdir /media/mint/emby then it won't. Did a fresh install of Linux mint to make sure this is all that's needed an didn't even apt upgrade yet or apt update or nothing.

It's as simple as chmod the /media/mint  (if mint is your username for example). This may work for NTFS external drives too.

sudo chmod 777 /media/mint

my harddrives automatically mount under /media/mint/4TBtv

but you couldn't add a library in emby server. Do 755 if you don't save your images or .bif images in the folders.

 

  • Thanks 1
Link to comment
Share on other sites

  • 4 months later...
Zellogize

Okey. I've been having issues with the permissions of my folders. But I think I've got it fixed permanently now.

To start of. Got an internal disk mounted as /media/username/. Using Linux mint 20.2 for the Emby server (remote control so everything is done from my normal desktop). All pictures, info, subs etc are stored in the folder of the media/movie. Everything I take to the Emby server is first fixed, edited or renamed(if needed) on my normal desktop. Which running Windows 10. Enough about my setup.

 

The Issue I had was it didn't continue to give me access with new movies and sometimes old ones was not allowed by Emby to view.

Sometimes I hade the problem when it just said "option -m Invalid argument near character x". Got me checking that I spelled my username and emby group correctly. Which it was. Double checked that my username and the group Emby was in the system. Both is. Then I changed to "setfacl -R -m u:username:rwX". It worked! Tried with "setfacl -R -m g:emby:rwX", also working. Good, now I could continue.

Tested on one folder named C. It worked, newest movies found in the catalogue. Did the same command for the whole Movies folder. All movies appeared now.

After I did what @Q-Droid explained with the default setting of allowing the group Emby using "setfacl -R -m d:g:emby:rwX /media/username/" last bit wherever you have the disk mounted. 

 

For me it's unclear why it didn't allow me to use setfacl -R -m username:emby:rwX. But if you're having a similar issue give the above a try. 

Another thing that's weird is that it wasn't enough with Emby having rw access, the X (execute?) needed to be there for it to work. Old movies became "stream unavailable" when I only used the rw. Might be because I got the covers/subtitles together with the movies and not in a separate folder. And by restricting emby access to write in any of the folders takes away that. Not sure why the movie by itself / old movies that normally worked or are done with pictures/subs becoming unavailable. But someone else might be able to explain that.

 

After all this I think I got a better understanding of how Emby works in linux together with permission. And learned a bit of more linux while researching this. Which is always a win. Took a few hours of me reading and understanding. But the ending makes it worth it!

Edited by Zellogize
  • Thanks 1
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...