What needs to be configured for a user to execute rootless Podman commands without using SSH?
Environment
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 9
- Red Hat Enterprise Linux 10
podmanexecuted as a non-root user
Issue
- When using
podmanas a rootless user, typically that user must have gained access to the system viasshin order to ensure all the correct settings and variables are in place forpodmanto execute properly under that user. - When using
sshto log in as a user, rootlesspodmancommands work fine, however when usingsuorsu - myuser, I get errors when runningpodmancommands. - What settings must be enabled to ensure that a user does not need to use
sshto gain access to a system, but can still execute rootlesspodmancommands? - Rootless
podmancommands fail withError: could not get runtime: cannot re-exec process
Resolution
- It is currently not supported by Red Hat to use rootless podman via another other means than using
sshto access the user you intend to executepodmanas. Usingsuorsu -is not a currently supported mechanism of rootless podman. - The following steps show a completely unsupported method of working around this, and as every user environment has the potential to be different, cannot be guaranteed to work or even troubleshot by Red Hat Support at this time.
- Red Hat evaluated this request in RFE 1996757 and while we recognize that it is a valid request, we do not expect this to be implemented in the product in the foreseeable future. This is due to other priorities for the product and not a reflection of the request itself.
Unsupported Method of Allowing Rootless Users to Use Podman without SSH
- None of the steps below have any guarantee of working properly. They are provided as a convenience only if you are seeking a solution that
- It is first advised to ensure that logging in as the user via
ssh user@localhoston the system works when executing rootlesspodmancommands. If logging in viasshallows a user to properly execute rootlesspodmancommands, then proceed to the next section. -
Otherwise, some other issue is preventing users from running rootless
podmancommands and it is advised to review your configuration. Reviewing the following may help in reviewing your setup for rootless users: -
If none of the above articles resolve your issues running rootless
podmanwhile using ssh then please contact Red Hat Support if you have a valid support agreement with Red Hat.
Steps to configure rootless podman without requiring ssh
-
As the root user on the host, ensure session lingering is enabled for the user you intend to run rootless
podmancommands as (replacing$USERwith your existing user's login):# loginctl enable-linger $UID -
As the rootless user, ensure that upon login the
XDG_RUNTIME_DIRenvironment variable is configured and points to your intendedrunrootdirectory forpodmanis. For example, using the defaultXDG_RUNTIME_DIRof/run/user/$UID, the following command could be executed to set this value at login time:$ echo "export XDG_RUNTIME_DIR=/run/user/$UID" >> ~/.bashrc -
If you intend to use a different
runrootfor your rootless user'spodmaninstance, adjust the path of theXDG_RUNTIME_DIRas needed and ensure it is set properly upon login. -
As the rootless user, ensure that upon login it is possible for the user to access a
dbussession by having theDBUS_SESSION_BUS_ADDRESSset to the proper path.- For a user with a UID of
1000, the proper path would be:
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus - For a user with a UID of
Root Cause
- At this moment in time, the only expected working method of accessing
podmancommands as a rootless user is via usingssh, either directly to the system or tolocalhost. - When using
sshto log in to a host, quite a few variables are automatically configured as well as some additionalsystemdconfigurations. - When using
suorsu -to log in to a host, these values must be manually configured for rootlesspodmanto function properly.
Diagnostic Steps
- It is first best to log in via
sshto the host, including if it is justssh localhost, to ensure that rootlesspodmancan be properly executed and works as expected prior to seeing ifsuworks.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments