So, I’ve finally gotten a comfortable setup for my beautiful podman quadlets, its a simple debian system, heavily systemd reliant, and I’m curious about how yall admin such a thing, I’ve got a couple of scripts to create users, skel the home directories, and templates for services.
I’m particularly curious about handling subids, I’m pretty careful about them and not using too too many, mostly for being afraid of running out of them lol. But from what I’ve seen, linux allows you to go real stupid with it, like having a shitton of range and entrances.
I personally give my quad users like 500 subids to work with and they generally work fine, it really depends on if I’m gonna have more than one service running on them or not.


I approach it the same as I did with Docker, one user per container.
I started with rootless but networking within Podman is moot with multiple users per container. And one user for all containers to get networking has to lead to subUID clashes (and thus escape vectors) - unless someone can explain how not…
But root Podman is just as secure anyway, and easier, so I just roll with
UserNS=autoand useidmap=on the volumes to enable writing as the specified user for the container. And networking in Podman works because it’s one user space. By defaultUserNS=autogives1024subUIDs to a container. I had to up that to the expected max of65535for Frigate to work (example bit I use with idmap, UserNS with the size and group mapping, and GroupAdd):Volume=/mnt/camraz:/media/frigate:rw,noexec,nosuid,nodev,Z,idmap=uids=@1111-0-1;gids=@1111-0-1#1020-1020-1 UserNS=auto:size=65535,uidmapping=105:@105:1,gidmapping=105:@105:1 GroupAdd=105So what’s going on here is on the
Volume=I have the camera folder mounted to where Frigate wants it, and I specify that it accesses that volume withidmap=andfrigate’s UID/GID1111and thecameragroup I made at GID1020.The order for the
idmapis@${hostUID}-${containerUID}-${num2map}. The@symbol means that1111is an absolute host UID; drop that and1111is pulled from thecontainerssubUID/subGID list. Most containers run asroot(0) so you just map to that user.Side quest: For containers that have one of those mini-hypervisors like LinuxServers images and their “S6” thing, I worked around them starting with a
rootuser but then requiring moving to anon-rootuser by specifyingPUID=1andPGID=1then settingidmap=uids=@1999-0-2;gids=@1999-0-2and reserving1999as usernamecontainerNameStartupand2000ascontainerName. Thisidmap=maps host1999to container0but maps two UID/GIDs consecutively, so it also maps host2000to container1keeping everything lined up perfectly - while LinuxServer images still don’t get host root like they so desperately want.GroupAdd=105adds in the group105to the container, which is notably not the host group105.UserNSis needed to complete that. This just makes that group exist in the container.UserNS=auto:size=65535,gidmapping=105:@105:1accomplishes the subUID/subGID size allocation to the expected default max of 65535 (because Frigate needs it) and the group connection from host105to container105. Note that this syntaxhelpfullyuses the opposite order asidmap=. It goes${containerUID}:@${hostUID}:${num2map}and uses colons instead of dashes.Every other container is cool with the default 1024 (just
UserNS=auto). The subUIDs are pulled from a non-existent user namedcontainersthat you need to enable for Podman root to work withUserNS, and it has like 2millionbillion or something with their recommended setup, so it’s good on subUIDs/subGIDs.Command to set up root Podman with
UserNS=auto:sudo echo "containers:2147483647:2147483648" >> /etc/subuid sudo echo "containers:2147483647:2147483648" >> /etc/subgidYou can also have
UserNS=autoand run the container as a specific host user directly instead of “nobody” with:UserNS=auto:uidmapping=0:@1111:1,gidmapping=0:@1111:1Same idea as how I mapped in the host group
105above. Where therootuser0is mapped to the host (via@) user1111so the container runs as the user. I don’t use that because theidmap=works perfectly and then the container doesn’t even run as the user that controls the files directly. But maybe there will be a use for that sometime(?).And I do have a fuckton of users; Debian once complained it ran out of numbers or something after like 20 users, so I just ran the first thing I found to make the UID limit some really big number, and I never thought about it again! No idea what it was…
**Edit: ** I cleaned it up and added examples
Also I mostly work with UIDs not users per-say, so I specify UID
1111has access to Frigate files. I just make a user namedfrigateto make it a bit easier for me. When you dols -lit saysfrigateinstead of1111; life is easier.Overall, it has been a lot of work to divine these things because the documentation and useful examples for Podman are confusing and non-existent. I think I’ve gotten most of this
idmap=andUserNS=stuff working from reading GitHub issues that drop little tidbits. But after I get it working as I want it, it’s solid, and I can now rinse-and-repeat in the future. No Docker daemon to fuck with or get hacked, and it’s reliable since I just let systemd start these quadlets up.I’m not 100% done, but I’m close. Outstanding issue right now is that on server restart sometimes some Podman networks don’t actually start up correctly and then containers that want them fail to start because of that (I have to restart the Podman network via
systemctlto get them to exist in Podman). But eventually I’ll find the stupid GitHub issue where someone mentions something relevant for that, and then I’ll be golden!excellent solution, just have root container to --user and use the auto userns, had no idea about that, sounds super convenient. Much more self contained, just let the program do its thing, I had no idea about userns=auto with root, tysm for ur input!! :)
I added examples so you don’t have to dig as far if you want to give it a try!
this is incredible thank you very much, I will read through this once I have more energy lmao, this looks like okay dense content, very interesting