submitted 4 weeks ago* (last edited 4 weeks ago) by [email protected] to c/[email protected]

Edit: I found the solution! All I had to do was add the uid with my username, then I also had to add "forceuid" for it to actually go through. My fstab entry now looks like:

// /mnt/Home-NAS/Media-Library cifs user=Jellyfin,password=password,uid=my_uid,forceuid,iocharset=utf8 0 0

Thank you @[email protected] for posting the solution from Stack Exchange!

Hello! I have an Ubuntu server with a NAS mounted using cifs-utils, and I've created an entry in fstab for the share to be mounted at boot.

My fstab entry looks like this:

// /mnt/Home-NAS/Media-Library cifs user=Jellyfin,password=password,iocharset=utf8 0 0

(The password is not actually "password" of course)

However, while I'm able to access the share perfectly fine, and even have a Jellyfin server reading from it, I cannot write files to the share without using sudo. I have some applications that manage metadata for music, and they're not able to change or add files in any way.

I am however able to access the share from my Fedora machine just fine with the same credentials, since I use KDE, I just added them to the default "Windows Share Credentials" setting. I don't have the issue where I have to use sudo to modify files, so I know it's just an issue with the share mounted to the server and not permission issues on the NAS itself.

What am I doing wrong?

top 9 comments
sorted by: hot top controversial new old
[-] RedWeasel 12 points 4 weeks ago* (last edited 4 weeks ago)

Try adding to the fstab options uid=#### with the #### replaced with the user id you are using. If you are using more users other options may be needed.

Edit: also check 'man mount.cifs' for other options.

[-] [email protected] 2 points 4 weeks ago

Could it be set with a gid and with write permissions for the group, therefore giving users in that group write access?

[-] RedWeasel 3 points 4 weeks ago

Yes, that should work as well.

[-] [email protected] 2 points 4 weeks ago
[-] [email protected] 1 points 4 weeks ago* (last edited 4 weeks ago)

That unfortunately didn't work, but I really do appreciate your response.

I just had to add an entry for my uid and then "forceuid", and it worked!

[-] [email protected] 6 points 4 weeks ago* (last edited 4 weeks ago)

To amplify RedWeasel’s very good answer, fstab runs as root and unless you specify otherwise, the share will mount with root as the owner on the local machine. From the perspective of the Samba server, it’s the Jellyfin user accessing the files, but on the local machine, but local permissions come into play as well. That’s why you can get at the files when you connect to the share from Dolphin in your KDE system—it’s your own user that’s mounting the share locally.

[-] [email protected] 4 points 4 weeks ago* (last edited 4 weeks ago)

Here a post with similar question and an answer from two years ago where the OP claims that using uid= did not work : https://unix.stackexchange.com/questions/687764/mount-t-cifs-only-mounts-as-root-and-no-longer-honours-uid-and-gid

From that link the comment starting with this paragraph below may work :

It occurs to me that as (a) I'm the only one accessing this share and (b) mode changes are not written back to the CIFS filesystem anyway, it doesn't matter whether the mode is 777 or 755. Therefore, the following fixes the issue:

[-] [email protected] 3 points 4 weeks ago

That worked! Thank you very much!

[-] [email protected] 1 points 4 weeks ago

I think you should mount using gvfs or kiofuse and not fstab, to have user permissions?

Or use udisksctl

this post was submitted on 24 Apr 2024
20 points (88.5% liked)


44648 readers
945 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.


Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago