| Post Reply | RetroFed Forum Forum Index » Selfhosted |
| Author | Message | ||
|---|---|---|---|
MoogleMaestro
lemmy.zip
MoogleMaestro@lemmy.zipJoined: 2024-07-26 |
Self cross-posting from: https://lemmy.zip/post/70909658 Intention to have slightly better visibility from the self-hosted crowd and I'm interested in more general feedback on this too.
|
||
| 38 Original | |||
|
frongt
lemmy.zip
frongt@lemmy.zip Joined: 2025-07-31 |
Does the user have permission to that file? |
||
| 3 | |||
MoogleMaestro
lemmy.zip
MoogleMaestro@lemmy.zipJoined: 2024-07-26 |
"/usr/share/nginx/html/index.html" is forbidden (13: Permission denied) Does the user have permission to that file?
As far as I understand, it should as it's embedded inside the actual image file and not mounted. I'm having other strange behaviour on non-1000 uid accounts. For example, running It does make me think that something needs to be configured for non-uid 1000 users on podman. This is not replicable on arch linux on my raspberry pi, fwiw. |
||
| 1 | |||
chameleon
fedia.io
chameleon@fedia.ioJoined: 2024-06-21 |
Complete shot in the dark, but I would start by comparing Modern distro installers tend to give the user created during setup 65536 IDs, but |
||
| 4 | |||
|
Svinhufvud
sopuli.xyz
Svinhufvud@sopuli.xyz Joined: 2023-06-24 |
Sorry for not answering to your question directly, but why not just use subuids for separation instead?
|
||
| 1 | |||
MoogleMaestro
lemmy.zip
MoogleMaestro@lemmy.zipJoined: 2024-07-26 |
Sorry for not answering to your question directly, but why not just use subuids for separation instead? podman run -d --restart unless-stopped \ --uidmap "+0:@100001:1" \ --name nginx-1 \ --port 8081:80 \ docker.io/library/nginx podman run -d --restart unless-stopped \ --uidmap "+0:@100002:1" \ --name nginx-2 \ --port 8082:80 \ docker.io/library/nginx
I mean, I might be wrong, but this only changes the mapping right? In the case that user broke containment, I would assume that they would have the user id of the user that's running the process? Granted this is all in theory so I'm not sure exactly -- that might be a perfectly reasonable way to do it. |
||
| 3 | |||
MoogleMaestro
lemmy.zip
MoogleMaestro@lemmy.zipJoined: 2024-07-26 |
Complete shot in the dark, but I would start by comparing podman system info between the two user accounts, with the most importance on the idMappings. Podman is usually configured to use rootless by default, and this can result in wildly different behavior based on whether /etc/subuid and /etc/subgid are configured to give your user IDs or not. See tutorial if your user 1001 is missing. Modern...
I think I have uids set up, but I'm not positive they're set up correctly. Here's an example of
Syncthing in this case isn't running any podman containers, all sharing is done bare-metal. userA is working, but userB and userC do look like they're configured "correctly" at first glance.
Note: The user in question here is |
||
| 1 | |||
chameleon
fedia.io
chameleon@fedia.ioJoined: 2024-06-21 |
I think I have uids set up, but I'm not positive they're set up correctly. Here's an example of /etc/subuid for example, with it a bit anonymised for my specific user setup: core:524288:65536 syncthing:589824:65536 userA:655360:65536 userB:720896:65536 userC:786432:65536 Syncthing in this case isn't running any podman containers, all sharing is done bare-metal. userA is working, but userB and u...
That looks correct to me if uid 1101 == userC. Sorry, don't really know what it might be then. |
||
| 2 | |||
|
rhymepurple
lemmy.ml
rhymepurple@lemmy.ml Joined: 2021-11-29 |
This is due to a security design deicison of Podman. Each user's network(s) is only available to that user. This is great for most services, but can cause issues for some services - especially reverse proxies. Unfortunately, I'm not aware of an ideal solution. The only solution I've seen is moving the reverse proxy to another host and exposing the services' ports on the localhost. I hope someone can provide a better solution! |
||
| 4 | |||
MoogleMaestro
lemmy.zip
MoogleMaestro@lemmy.zipJoined: 2024-07-26 |
This is due to a security design deicison of Podman. Each user's network(s) is only available to that user. This is great for most services, but can cause issues for some services - especially reverse proxies. Unfortunately, I'm not aware of an ideal solution. The only solution I've seen is moving the reverse proxy to another host and exposing the services' ports on the localhost. I hope someon...
OK now this would make some sense but would definitely be a bit of a show stopper for me. I'll give it a try though. Edit: Unfortunately this didn't solve the issue. I thought it did for a minute, but it was the browser cache I think auto-filling the correct result. |
||
| 1 | |||
|
frongt
lemmy.zip
frongt@lemmy.zip Joined: 2025-07-31 |
As far as I understand, it should as it's embedded inside the actual image file and not mounted. I'm having other strange behaviour on non-1000 uid accounts. For example, running docker.io/library/httpd using the podman examples page on an account that isn't userid 1000 will create an issue where it complains that libgcc_0 isn't installed. This works flawlessly on the uid 1000 user. It does mak...
Shell into the container and find out. |
||
| 2 | |||
|
robber
lemmy.ml
robber@lemmy.ml Joined: 2022-11-25 |
This is due to a security design deicison of Podman. Each user's network(s) is only available to that user. This is great for most services, but can cause issues for some services - especially reverse proxies. Unfortunately, I'm not aware of an ideal solution. The only solution I've seen is moving the reverse proxy to another host and exposing the services' ports on the localhost. I hope someon...
No expert but don't the logs look like the requests are coming through? |
||
| 1 | |||
|
robber
lemmy.ml
robber@lemmy.ml Joined: 2022-11-25 |
You use podman-compose with the Podman backend? And there are no volumes mounted, just to be sure? |
||
| 4 | |||
|
Overspark
piefed.social
Overspark@piefed.social Joined: 2025-09-01 |
OK now this would make some sense but would definitely be a bit of a show stopper for me. I'll give it a try though. Edit: Unfortunately this didn't solve the issue. I thought it did for a minute, but it was the browser cache I think auto-filling the correct result.
The solution to this can be multiple reverse proxies. Each user runs it's own reverse proxy (if you actually need one, otherwise you let the container bind directly to a port on the host system). Then you run one main reverse proxy on port 80/443 that proxies to those other ports based on hostname. The upside of this construction is that containers running as different users can't directly access each others internal networks, which is much better for security, as those networks often contain barely protected services, which is why you're using a reverse proxy in the first place. Edit: there are different options with custom networks and such, but they're even more complicated so I wouldn't advise them. |
||
| 1 | |||
MoogleMaestro
lemmy.zip
MoogleMaestro@lemmy.zipJoined: 2024-07-26 |
You use podman-compose with the Podman backend? And there are no volumes mounted, just to be sure?
No volumes mounted and yes, it's using the podman backend. Just double checked it wasn't using the docker one. |
||
| 2 | |||
glizzyguzzler
piefed.blahaj.zone
glizzyguzzler@piefed.blahaj.zoneJoined: 2025-06-20 |
The best way to run Podman is root with UserNS to dole out UID/GID protection. Running Podman as root allows you to share networks between containers while having the containers run under different users. If you go rootless, you'd need to run under one user to share the user's network space with all the containers you want. As for your issue, I can't really divine what the problem is from the errors. I avoid nginx because it's coded to not play well with user abstraction and changing the user with the files it wants to write to etc. Gotta write into a ton of random folders! So not sure exactly what is up. But with Podman root it is easy to run as root Try this setup (it is in Podman Quadlet format, apologies I don't know the compose versions). It runs the container as root Note that in Debian 13 symlinks are broken and won't work with
Root Podman and UserNS=auto needs a
The documentation for Podman is critically lacking in the "hobbyist" space. Hope this helps. Edit: This approach works well because most Docker containers are built assuming they'll run as root Edit2: I've noticed you said no Volumes, so drop that. But you can still use the UserNS mapping to run it as root internally which should fix the internal permissions issues. The tmpfs stuff is if you declare
Edit3:
Here's an output from my frigate container. Internally (USER) it is root, externally (HUSER) it's some random UID. I've also mapped the internal group (GROUPS) 105 to the external group (HGROUPS) 105 so that it has render access. |
||
| 8 | |||
forbiddenlake
lemmy.world
forbiddenlake@lemmy.worldJoined: 2023-06-11 |
The best way to run Podman is root with UserNS to dole out UID/GID protection. Running Podman as root allows you to share networks between containers while having the containers run under different users. If you go rootless, you'd need to run under one user to share the user's network space with all the containers you want. As for your issue, I can't really divine what the problem is from the e...
Note that sudo echo does not work as non root because the shell redirection is attempted before the command runs. You want |
||
| 6 | |||
|
robber
lemmy.ml
robber@lemmy.ml Joined: 2022-11-25 |
No volumes mounted and yes, it's using the podman backend. Just double checked it wasn't using the docker one.
The service starts as it should, right? The errors appear only on request, right? Any other sections in the compose logs that seem relevant? |
||
| 1 | |||
|
InnerScientist
lemmy.world
InnerScientist@lemmy.world Joined: 2023-06-30 |
What are the assigned subuids and subgids for userA and userB? |
||
| 1 | |||
glizzyguzzler
piefed.blahaj.zone
glizzyguzzler@piefed.blahaj.zoneJoined: 2025-06-20 |
Note that sudo echo does not work as non root because the shell redirection is attempted before the command runs. You want echo foo | sudo tee -a /bar instead
So the sudo echo does echo as sudo but doesn’t carry over? Makes sense damn I hate bash! Any way to keep the >>? Or do you need to tee? Cause the >> is pretty cool |
||
| 1 | |||
|
in_my_honest_opinion
piefed.social
in_my_honest_opinion@piefed.social Joined: 2026-01-21 |
You might want to switch to rootless quadlets with subuids https://www.golinuxcloud.com/rootless-podman-quadlet/ You'll get unified logging through systemctl and journalctl, you'll also get segmented user space and if you need persistent storage that you can gate at subuid. |
||
| 7 | |||
|
frongt
lemmy.zip
frongt@lemmy.zip Joined: 2025-07-31 |
So the sudo echo does echo as sudo but doesn’t carry over? Makes sense damn I hate bash! Any way to keep the >>? Or do you need to tee? Cause the >> is pretty cool
That's the thing about computers, they do exactly what you tell them. You should also know that echo is a bash shell builtin, so the echo you're running with |
||
| 2 | |||
|
rhymepurple
lemmy.ml
rhymepurple@lemmy.ml Joined: 2021-11-29 |
OK now this would make some sense but would definitely be a bit of a show stopper for me. I'll give it a try though. Edit: Unfortunately this didn't solve the issue. I thought it did for a minute, but it was the browser cache I think auto-filling the correct result.
I'm not trying to convince you of this solution (I personally don't like it), but I am curious what didn't work for you. Were you unable to get the reverse proxy to serve each service? Were you unable to have the services behind the reverse proxy to talk to each other? |
||
| 1 | |||
|
rhymepurple
lemmy.ml
rhymepurple@lemmy.ml Joined: 2021-11-29 |
No expert but don't the logs look like the requests are coming through?
I didn't see the logs when I originally posted. However, I'm not sure what the logs indicate. It could be that nginx successfully received the request and received an authorization error from Podman's networking stack then returned a 503 error to the client (or logged the 503 response that was returned to nginx). |
||
| 1 | |||
|
rhymepurple
lemmy.ml
rhymepurple@lemmy.ml Joined: 2021-11-29 |
The solution to this can be multiple reverse proxies. Each user runs it's own reverse proxy (if you actually need one, otherwise you let the container bind directly to a port on the host system). Then you run one main reverse proxy on port 80/443 that proxies to those other ports based on hostname. The upside of this construction is that containers running as different users can't directly acce...
I think this is what OP was originally trying, but this approach breaks when each service's Podman service runs on its own localhost user. |
||
| 1 | |||
|
Overspark
piefed.social
Overspark@piefed.social Joined: 2025-09-01 |
I think this is what OP was originally trying, but this approach breaks when each service's Podman service runs on its own localhost user.
You can use the per-user reverse proxies as a bridge between the host network and the user-specific internal network. So for a user coming from outside the path looks like this: User -> main reverse proxy on main IP and port 80/443 -> user-specific proxy listening on main IP with port 8080 and proxying to user-specific internal network -> destination container listening on user-specific internal network. And for a container running as a different user the path will be the same, but the user-specific reverse proxy will be listening on port 8081 and higher for example. |
||
| 1 | |||
|
rhymepurple
lemmy.ml
rhymepurple@lemmy.ml Joined: 2021-11-29 |
You can use the per-user reverse proxies as a bridge between the host network and the user-specific internal network. So for a user coming from outside the path looks like this: User -> main reverse proxy on main IP and port 80/443 -> user-specific proxy listening on main IP with port 8080 and proxying to user-specific internal network -> destination container listening on user-specifi...
This would require the main proxy running as root or with some other sort of elevated privileges to allow cross-user network access though, right? If so, wouldn't that essentially make the user-specific reverse proxy unnecessary in most cases? |
||
| 1 | |||
|
Overspark
piefed.social
Overspark@piefed.social Joined: 2025-09-01 |
This would require the main proxy running as root or with some other sort of elevated privileges to allow cross-user network access though, right? If so, wouldn't that essentially make the user-specific reverse proxy unnecessary in most cases?
It can be run as root, but it doesn't have to, as it is only accessing the host network, not any user-specific network. Crossing the boundaries from host network to user-specific networks is left to the reverse proxies running as those specific users. Port 80 and 443 can normally only be bound as root, but you can work around that with either firewall rules or by using something like this in your sysctl config:
|
||
| 0 | |||
|
lambalicious
lemmy.sdf.org
lambalicious@lemmy.sdf.org Joined: 2023-07-26 |
It can be run as root, but it doesn't have to, as it is only accessing the host network, not any user-specific network. Crossing the boundaries from host network to user-specific networks is left to the reverse proxies running as those specific users. Port 80 and 443 can normally only be bound as root, but you can work around that with either firewall rules or by using something like this in yo...
Do NOT do the latter! It allows unprivileged users in the system to spawn processes to take privileged ports starting with port 80 all over to port 1024, including relevant ports like 443 (HTTPS)! |
||
| 0 | |||
| Post Reply |
Back to top |