this post was submitted on 09 Jun 2024
39 points (100.0% liked)

Selfhosted

45585 readers
964 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 2 years ago
MODERATORS
 

I have been using linux for a couple of years already, very casually, just browser, media, games. Recently I bought dell micro pc and installed proxmox on it. I don't have a lot of hdds or raid or anything, just one 6tb usb external drive. I know, I could lose everything, but I don't have anything important in there, just media. It's a relatively new drive, so I hope it will hold for at least half a year, and then I plan to buy proper hdds.

Hdd is connected to the proxmox host with usb, and then with mount points to lxc containers. Audiobooshelf, samba, qbittorent, all containers are debian 12.

When I download book with qB lxc, it automatically shows up in audiobookshelf (abs) lxc thanks to mount points. Abs can play it but, I can't change cover, delete, move it etc, because of permissions. This screenshot is from proxmox host.

Same thing happes when I manually upload the book to audiobookshelf, then other lxc containers have problem accessing it. Or when I upload something to the server with samba.

I know how to change it with chmod and chown, but when I download new book it is the same thing again, I don't want to manually change permissions and ownership every time new folder/file appears in hdd. In lxc container I cant even change ownership, it says: "Operation not permitted" even though I have root.

This is my samba config. It's terrible and unsecure, but after 2 days of trying to make it work, I just wanted to try everything. I will probably switch to nfs, idk if it will help.

I'm really lost, idk how to make lxc containers talk to each other through those mounts points without breaking permissions/ownership. Is there some other way? Idk if there is a very simple solution and I just made fool of myself. I know that root and 777 eveywhere is bad idea, but I wanted to at least first get everything working. And I don't plan to connect anything to the internet in the near future anyways.

It's really late here, and I have to work tomorrow, so I won't be able to reply until tomorrow evening.

top 14 comments
sorted by: hot top controversial new old
[–] 4am@lemm.ee 10 points 10 months ago* (last edited 10 months ago) (1 children)

It’s UID/GID 10000 on the host because you are using an unprivileged LXC container. Unprivileged means that “root” inside the container (which is just a user space of the host with access restrictions) is user 10000 on the host - this is so that files and processes inside the container don’t run with the real UID zero, where they could plant a malicious file, or run a malicious program that escapes containment that ends up with root access on the host.

Quickest way to make this work over samba is to force user 10000 and force group 10000. That way everything connecting to Samba would see the files as their own.

Honestly the better solution is to make your software inside the containers run with a local non-root user (which would be something like 10001) and then force samba to use that. Then nothing is running as root in or out of the containers. Samba will still limit access to shares based on the samba login, but for file access purposes it will still use the read/write levels of your non-root user (because of the force- directives)

[–] Cossty@lemmy.world 1 points 10 months ago

Thx this sounds like the best solution. Definitely trying it out. Idk how well I will be able to do it, Because I didn't even made those containers myself. I just used proxmox helper scripts. Something came up today and I didn't have time again, will try it tomorrow.

[–] nitrolife@rekabu.ru 2 points 10 months ago (2 children)

the idea is that: all your applications work under the same user. or at least under the same group. because this is exactly how the differentiation of rights is applied.

A good plan is to create some kind of user in all three containers and run qbittorrent, samba and the third application under it.

A bad plan is to run everything under a random user with 777 rights, but this is a really bad plan.

Create a user in all three containers and work under it. That is not hard. Run qbittorent with that user. Config will be there: /home/user/.config . Then set that user for samba. I don't know third app , but I think you can find how change user in manual.

[–] minnix@lemux.minnix.dev 1 points 10 months ago (2 children)

Also never use samba. At the very least use NFS.

[–] possiblylinux127@lemmy.zip 4 points 10 months ago

NFS is a pain in the ass

[–] 4am@lemm.ee 3 points 10 months ago (1 children)

NFS is always cranky for me, and you can’t get it to use symlinks at all (yeah Samba’s implementation is janky but at least it exists)

[–] minnix@lemux.minnix.dev 2 points 10 months ago (1 children)

NFS does symlinks but they have to be configured correctly.

Samba may have not given you issues in the past, but it also doesn't give you any security.

[–] DarkDarkHouse@lemmy.sdf.org 1 points 10 months ago (1 children)

Doesn't give you any security? Please elaborate.

[–] minnix@lemux.minnix.dev 1 points 10 months ago

Elaborate on why samba is bad when it comes to security? Like list a bunch of links like this or write a paragraph summarizing them like a chatbot?

[–] Cossty@lemmy.world 1 points 10 months ago

Ok, that doesn't sound hard. I hope there are no more unforeseeable problems. When I create the new user in containers, should I create the same user in proxmox host and change ownership of the hdd, and all existing files in it, to it? Probably yes, right? Don't have time today again, will try it tomorrow after work.

[–] Decronym@lemmy.decronym.xyz 1 points 10 months ago* (last edited 10 months ago)

Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:

Fewer Letters More Letters
LXC Linux Containers
NAS Network-Attached Storage
NFS Network File System, a Unix-based file-sharing protocol known for performance and efficiency

[Thread #794 for this sub, first seen 10th Jun 2024, 15:55] [FAQ] [Full list] [Contact] [Source code]

[–] voracitude@lemmy.world 1 points 10 months ago* (last edited 4 months ago) (1 children)
[–] nitrolife@rekabu.ru 2 points 10 months ago (1 children)

Topic starter don't use docker containers. He use lxc containers. LXC is virtual machines on host kernel. Case is that: He have 3 virtual machines with shared disk. In 3 VMs have 3 different applications. Applications work under different users and can't rewrite data on shared disk. That is user permissions problem.

[–] voracitude@lemmy.world 1 points 10 months ago* (last edited 4 months ago)