Skip to content

[BUG] USER_NAME=b falsely matches 'bin' user due to loose grep pattern #118

Closed

Description

@brendandebeasi

Current Behavior

Setting USER_NAME=b causes the container to fail with:

*** USER_NAME cannot be set to an user that already exists in /etc/passwd. Halting init. ***

However, there is no user b in /etc/passwd. The init script appears to use a loose pattern match (e.g., grep "^b") which incorrectly matches the bin user.

Expected Behavior

Short usernames like b should work if they don't exactly match an existing username. The check should use exact matching, e.g.:

grep "^${USER_NAME}:" /etc/passwd

instead of:

grep "^${USER_NAME}" /etc/passwd

Steps To Reproduce

  1. Run container with USER_NAME=b:
docker run --rm -e USER_NAME=b -e PUBLIC_KEY="ssh-ed25519 AAAA..." lscr.io/linuxserver/openssh-server:latest
  1. Observe error: USER_NAME cannot be set to an user that already exists

  2. Verify b doesn't exist:

docker run --rm lscr.io/linuxserver/openssh-server:latest cat /etc/passwd | grep "^b:"
# No output - user 'b' does not exist
  1. The bin user exists and starts with 'b', causing false positive:
bin:x:1:1:bin:/bin:/sbin/nologin

CPU Architecture

x86-64

Docker Creation

docker run -d \
  -e PUID=1000 \
  -e PGID=1000 \
  -e USER_NAME=b \
  -e PUBLIC_KEY="ssh-ed25519 AAAA..." \
  -p 2222:2222 \
  lscr.io/linuxserver/openssh-server:latest

Container Logs

[migrations] started
[migrations] no migrations found
*** USER_NAME cannot be set to an user that already exists in /etc/passwd. Halting init. ***

Environment

  • OS: Ubuntu 22.04 on Dokploy
  • Docker: Docker Swarm mode
  • Image version: 10.2_p1-r0-ls213

Activity

  1. github-actions commented on Jan 21, 2026

    @github-actions

    Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

  2. added a commit that references this issue on Jan 21, 2026
    155cbf4
  3. LinuxServer-CI commented on Feb 21, 2026

    @LinuxServer-CI
    Contributor

    This issue has been automatically marked as stale because it has not had recent activity. This might be due to missing feedback from OP. It will be closed if no further activity occurs. Thank you for your contributions.

  4. brendandebeasi commented on Feb 21, 2026

    @brendandebeasi
    Author

    @LinuxServer-CI is there something else I am supposed to do here?

  5. brendandebeasi commented on Feb 21, 2026

    @brendandebeasi
    Author

    @thespad is this PR waiting on something for me? Not sure why the bot marked it as stale.

  6. moved this from Issues to Done in Issue & PR Trackeron Feb 22, 2026
  7. added a commit that references this issue on Mar 23, 2026
    9e8ec5c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions