this post was submitted on 21 Jul 2023
17 points (84.0% liked)

Linux

48152 readers
758 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.

Rules

Related Communities

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

founded 5 years ago
MODERATORS
 

Hi all. I'm hoping to get some help from folks with more Linux experience than me. I'm not a Linux noob, but I'm far from an expert, and I have some huge gaps in my knowledge.

I have a Synology NAS that I am using for media storage, and I have a separate Linux server that is using that data. Currently the NAS is mounted with samba. it automatically mounts at boot via an entry in /etc/fstab. This is working okay, but I don't like how samba handles file ownership. The whole volume mounts as the user who mounts it (specified in fstab for me), and all the files in the volume are owned by that user. So if I wanted two users on my server to have their own directory, I would need to mount each directory separately for each user. This is workable in simple scenarios, but if I wanted to move my Lemmy instance volumes to my NAS, the file ownership of the DB and the pictrs volumes would get lost and the users in the containers wouldn't be able to access the data.

Is there a way to configure samba to preserve ownership? Or is there an alternate to samba that I can use that supports this?

Edit:

Okay, so I set up NFS, and it appears to do what I want. All of the user IDs carry over when I cp -a my files. My two users can write to directories that I set up for them that are owned by them. It seems all good on the surface. So I copied my whole lemmy folder over and tried to start up the containers, and postgres still crashes. The logs say "Permssion denied" and "chmod operation not permitted" back and forth forever. I tried to log into my container and see what is going on. Inside the container, root can't access a directory, which is bizarre. The container's root user can access that directory when I am running the container in my local filesystem. As a test, I tried copying the whole lemmy directory from my local filesystem to my local filesystem (instead of from local to NFS), and it worked fine.

I think this exact thing might be out of the scope of my original question, and I might need to make a post on !selfhosted@lemmy.world instead, as what I wanted originally has been accomplished with NFS.

you are viewing a single comment's thread
view the rest of the comments
[–] giloronfoo@beehaw.org 1 points 1 year ago (1 children)

Thanks for the detailed reply. I've seen mentions of authentication over the years, but the conclusion from every thread like this was that it was nearly impossible to setup.

This doesn't sound too bad.

[–] 2xsaiko@discuss.tchncs.de 1 points 1 year ago

Yeah, from a complexity perspective it really isn't a big deal if you just want a basic user/pass authentication setup without any other access controls, which is completely fine for a home network. You can run a single kdc on the same server as nfs, it doesn't use a lot of resources, and there's plenty of basic setup guides. And then once you have it, it could also be used to authenticate a bunch of other stuff like SSH, or ironically also for Samba in case you do need it for something that can't do nfs (e.g. a phone). I've yet to try those though.

I'm not sure why everyone says it's such a complex thing to set up, maybe the problem is rather more in-depth documentation, since it's lacking and you often find conflicting and sometimes just plain wrong information.

For example, I'm still not sure why my MacBook can mount the NFS share without a host key despite everything I've read suggesting that one is necessary. Maybe to actually limit what computers can log in to krb5 I need to set up pkinit (which requires a PKI)? I can't find answers and I've searched for a while now. Might be time to ask on the mailing list...