Skip to content

Docker containers can conflict with users on host system in Linux 3.15 #6345

@AkeemMcLennon

Description

@AkeemMcLennon

Creating a new user in a docker container via the adduser command will cause an error if the user already exists on the host system and the command is used with the --gecos flag to supply finger information. This command is commonly run by package managers to create non-privileged users for daemons (e.g. mysql, postgresql).

Expected result:
A new user is created in docker container regardless of whether or not it already exists in the host system.

Actual Result:
Creating a new user fails with the error

chfn: PAM: System error
adduser: `/usr/bin/chfn -f PostgreSQL administrator postgres' returned error code 1. Exiting.

Steps to Reproduce:

  1. Install the Linux 3.15 kernel on the host machine
  2. Run the following command, replacing "postgres" with any user that exists on the host machine
docker run -i -t ubuntu adduser --system --quiet --home /var/lib/postgresql --no-create-home \
            --shell /bin/bash --group --gecos "PostgreSQL administrator" postgres

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions