Best practice: run rootless containers under separate user or the same I ssh into? #28320
Replies: 1 comment
-
|
The recommended approach is to use a dedicated system user per service (or group of related services) rather than running containers under your personal login account. Here is the reasoning: Separate service user# Create a system user with no login shell
sudo useradd -r -m -s /usr/sbin/nologin podman-svc
# Enable lingering so systemd user services survive logout
sudo loginctl enable-linger podman-svcWhy this is better:
Managing it from your admin accountYou SSH in as yourself and use # Run a one-off command as the service user
sudo machinectl shell podman-svc@ /usr/bin/podman ps
# Or use sudo
sudo -u podman-svc XDG_RUNTIME_DIR=/run/user/$(id -u podman-svc) podman psFor day-to-day operations, define Quadlet unit files under the service user's systemd directory ( When running under your own account is fineFor development, testing, or throwaway experiments on your local machine, running under your personal account is perfectly fine. The separate-user pattern is mainly for production or long-running services where security boundaries and boot-time startup matter. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What's the best practice recommended by podman community - to create a separate system user for rootless podman containers and enable lingering for it or run containers on the same user I ssh into and perform administrative tasks using sudo?
Beta Was this translation helpful? Give feedback.
All reactions