mviereck / x11docker

Run GUI applications and desktops in docker and podman containers. Focus on security.
MIT License
5.62k stars 378 forks source link

Select username (or use USER set in image) for --sudouser option #442

Closed FSund closed 2 years ago

FSund commented 2 years ago

Is there any way to specify the username for the user when using the --sudouser option, or perhaps use the USER specified in the image?

mviereck commented 2 years ago

x11docker has an option --user:

     --user=N          Create container user N (N=name or N=uid). Default:
                       same as host user. N can also be an unknown user id.
                       You can specify a group id with N being 'user:gid'.
                       Special case: --user=RETAIN keeps image user settings.

So you can specify another host user to appear in container, or the one declared in image with USER if you use --user=RETAIN. Note: With --user=RETAIN --sudouser x11docker does not add the user to group sudo because it does no user setup at all. It just allows to access those privileges instead of (default) denying them. su would work.

FSund commented 2 years ago

Nice, thanks! I didn't realize that's what --user=RETAIN did.