Jump to content

The Dreaded File Permissions


centuryx476
Go to solution Solved by Q-Droid,

Recommended Posts

centuryx476

Hello,

I have successfully mounted a windows share in ubuntu. Added it to /etc/fstab, made a creds file. Put them in 755 mode.

I can go into emby and add the movies share as a library with no issues.

But when I try to add the metadata share as an alternate location I get the error "emby server requires write access to this folder"

In the screenshot below I did an ls -l on the two mounts and as far as I can see the permissions are identical.

Why is one mount working (movies) but the other mount (metadata) not ? Both windows share have the same permissions

File_Access.JPG.e4cc6386f74c5d9640fbc4eff7d81eac.JPG

I know this is something trivial that I am overlooking. I went thru the emby linux file guide but did not really help. I do not know what else to try.

I am on Ubuntu 20.04.2

I got everything else working (SSL, movies, tvshows, port access, remote access) except this last hurdle.

Thanks

 

Edited by centuryx476
Link to comment
Share on other sites

Q-Droid

Please attach full Emby server log.

Also the output from:

ls -l /mnt/winshare_embymetadata/metadata

namei -l /mnt/winshare_embymetadata/metadata

With root ownership and read-only permissions the emby server won't be able to create subdirectories and files.

 

Link to comment
Share on other sites

centuryx476

*** Error Report ***
    Version: 4.6.4.0
    Command line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_amd64.deb
    Operating system: Linux version 5.4.0-81-generic (buildd@lgw01-amd64-052) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #91-Ubuntu SMP Thu Jul 15 19:09:17 UTC 2021
    Framework: .NET Core 3.1.13
    OS/Process: x64/x64
    Runtime: opt/emby-server/system/System.Private.CoreLib.dll
    Processor count: 2
    Data path: /var/lib/emby
    Application path: /opt/emby-server/system
    System.UnauthorizedAccessException: System.UnauthorizedAccessException: Access to the path '/mnt/winshare_embymetadata/5ec340e8-5ddd-4983-be20-4c95da5f3c65' is denied.
     ---> System.IO.IOException: Permission denied
       --- End of inner exception stack trace ---
       at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
       at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
       at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
       at System.IO.StreamWriter.ValidateArgsAndOpenPath(String path, Boolean append, Encoding encoding, Int32 bufferSize)
       at System.IO.StreamWriter..ctor(String path)
       at System.IO.File.WriteAllText(String path, String contents)
       at Emby.Server.Implementations.IO.ManagedFileSystem.WriteAllText(String path, String text)
       at MediaBrowser.Api.EnvironmentService.EnsureWriteAccess(String path)
       at MediaBrowser.Api.EnvironmentService.Post(ValidatePath request)
       at Emby.Server.Implementations.Services.ServiceController.<>c__DisplayClass6_0.<VoidActionDelegate>b__0(Object service, Object request)
       at Emby.Server.Implementations.Services.ServiceController.Execute(HttpListenerHost appHost, Object requestDto, IRequest req)
       at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost appHost, IRequest httpReq, IResponse httpRes, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
       at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
    Source: System.Private.CoreLib
    TargetSite: Void ThrowExceptionForIoErrno(ErrorInfo, System.String, Boolean, System.Func`2[Interop+ErrorInfo,Interop+ErrorInfo])
    InnerException: System.IO.IOException: Permission denied
    Source:
    TargetSite:

Link to comment
Share on other sites

Q-Droid

Pasting log content isn't very helpful, please attach full log. 

Your mount options are likely what's locking ownership to root. When using CIFS shares you should also add the nobrl mount option. 

 

Link to comment
Share on other sites

centuryx476
6 minutes ago, Q-Droid said:

Pasting log content isn't very helpful, please attach full log. 

Your mount options are likely what's locking ownership to root. When using CIFS shares you should also add the nobrl mount option. 

 

There is ALOT of internal network information in the log that I don't want linked on a public forum.
Can you give an example of the "nobrl" option ?

Link to comment
Share on other sites

rodainas
4 minutes ago, centuryx476 said:

There is ALOT of internal network information in the log that I don't want linked on a public forum.
Can you give an example of the "nobrl" option ?

Hi, the internal information is only the server address that repeats over and over, you can use notepad++ for example, to replace all the ocurrences of that address on the log file.

  • Like 1
Link to comment
Share on other sites

Happy2Play
17 minutes ago, centuryx476 said:

I don't want linked on a public forum.

You can always pm the info to the one requesting it or sanitize the log before posting.

Link to comment
Share on other sites

Q-Droid
10 hours ago, centuryx476 said:

There is ALOT of internal network information in the log that I don't want linked on a public forum.
Can you give an example of the "nobrl" option ?

Like the others said you can scrub your log before attaching or dm'ing it.

Disclamer: I don't use CIFS mounts and can't test for exceptions. I don't know your current mount options or share usage and needs, so...

Compare the mount entry below to what you have and add/replace to suit your needs.

<host/share> <local path> cifs rw,uid=emby,gid=emby,nobrl,file_mode=0664,dir_mode=0775 0 0

 

 

Link to comment
Share on other sites

centuryx476

embyserver.txt

OK, I think I replaced everything in the file.

@Q-Droid What do you use for mounts ? if I have to use something else then I shall. The only thing is that the drives are windows based and that I cannot change.

 

OK so let me try and break it down in my head.
I have a full Windows Active Directory. Emby-server is using a user in ubuntu called "emby". Do I create a windows AD account in my domain called "emby" and then put that in the cifs creds file ?

Edited by centuryx476
Link to comment
Share on other sites

Q-Droid

I don't use network storage for my Emby server.

Focus on getting the permissions working for emby. If the shares can be mounted and accessed then don't mess with the credentials, AD or the Windows side yet.

Have you tried changing the fstab entry to use the options I posted above?

Link to comment
Share on other sites

centuryx476

Hmm,
I don't think my setup is NOT going to allow for this to work. Since the windows shares are NTFS as can be. I can get around all this if these were local connected drives, but in my situation I cannot do that. I cannot see a way to assign the "emby" user to these mounts!

The comment out was the original command in fstab. Using a credentials file that has an AD User/Password in it.

The bottom one is the one you supplied. The 997 and 998 is the emby info I get from "id emby".

LoadUp1.thumb.jpg.8be2f9b50b5ee636cd2789044fb0d982.jpg

Link to comment
Share on other sites

  • Solution
Q-Droid

You were not supposed to substitute your line with what I posted. It was so that you could review, compare and make changes to effect the permissions needed (add/replace).

Many people are using CIFS/SMB/NTFS with Emby on Linux. It can work just need to sort it out.

Removing the credentials is likely what caused it to fail. For the uid/gid you can use either the names or numeric values. 

Try this:

<host/share> <local path> cifs credentials=/etc/cifs-credentials,rw,uid=997,gid=998,nobrl,file_mode=0664,dir_mode=0755 0 0

 

 

Link to comment
Share on other sites

centuryx476

That did it.
<host/share> <local path> cifs credentials=/etc/cifs-credentials,rw,uid=997,gid=998,nobrl,file_mode=0664,dir_mode=0755 0 0

Emby is nice and happy now!!

Thank you very much for the assistance.

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