Skip to Content
Building OsКористувачі в образі

Користувачі в образі

User records живуть у os.users. Вони створюють accounts всередині образу; вони не пов’язані з website accounts OpenFactory або organization roles.

Canonical shape

{ "os": { "users": [ { "username": "deploy", "full_name": "Deployment Operator", "groups": ["sudo"], "shell": "/bin/bash" } ] } }

Supported fields: username, optional password, full_name, groups, shell і target-specific level для Elster/Vyatta images. Older examples з home або comment не відповідають canonical model і можуть ігноруватися.

User і group names обмежені safe Linux account characters і length. Shell має бути absolute path без whitespace або shell metacharacters.

Password behavior

Якщо password не задано, створюється password-locked account. Це preferred recipe state для key-only SSH, first-boot enrollment або deployment-time identity integration.

Якщо включено plaintext password, він стає sensitive build input і може бути exposed через saved recipes, logs або exports. Не використовуйте real production credential у recipe. Phone recipes мають збирати credentials на device, а не bake їх у image.

Перед disabling SSH password authentication переконайтеся, що approved public key або інший access method present і tested. Інакше correctly hardened image може бути inaccessible.

Groups and privilege

  • sudo і wheel можуть давати administrative authority залежно від distribution.
  • docker commonly дає root-equivalent control через daemon socket.
  • kvm дає access до virtualization devices, де present.
  • adm може expose sensitive logs.

Treat these as privileged groups і grant лише те, що account needs. Distribution-specific group names не portable.

Service accounts

Для noninteractive service account оберіть no-login shell, available на target, і omit administrative groups. Confirm generator і service unit preserve intended identity; recipe default може додати sudo, якщо groups omitted, тому надайте explicit empty group list, де доречно.

Verification

Test exact properties, що matter:

  • account exists з expected UID range;
  • primary і supplementary groups correct;
  • login shell і password-lock state correct;
  • home і file ownership, якщо generated elsewhere, correct;
  • unauthorized sudo і service access denied; та
  • approved login або enrollment path succeeds.

Do not infer least privilege з account creation alone.