mirror of
https://github.com/containers/podman.git
synced 2025-06-03 20:33:20 +08:00
Allow users to add host user accounts to /etc/passwd
Some containers require certain user account(s) to exist within the container when they are run. This option will allow callers to add a bunch of passwd entries from the host to the container even if the entries are not in the local /etc/passwd file on the host. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1935831 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -723,3 +723,11 @@ func SocketPath() (string, error) {
|
||||
// Glue the socket path together
|
||||
return filepath.Join(xdg, "podman", "podman.sock"), nil
|
||||
}
|
||||
|
||||
func LookupUser(name string) (*user.User, error) {
|
||||
// Assume UID look up first, if it fails lookup by username
|
||||
if u, err := user.LookupId(name); err == nil {
|
||||
return u, err
|
||||
}
|
||||
return user.Lookup(name)
|
||||
}
|
||||
|
Reference in New Issue
Block a user