useradd is not looking for --gid in --root
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
shadow (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Application: /usr/sbin/useradd
Doing:
THE_ID=70000
THE_NAME=aaaaa
groupadd --gid $THE_ID $THE_NAME
useradd --uid $THE_ID --gid $THE_ID --home-dir /home/$THE_NAME --create-home $THE_NAME
is working fine, but when specifying a --root, the provided --gid is not checked in the group file in the --root folder. Steps:
BASE_FOLDER=
cd $BASE_FOLDER
THE_ID=70000
THE_NAME=aaaaa
mkdir etc home
touch etc/group etc/passwd etc/shadow
groupadd --root $BASE_FOLDER --gid $THE_ID $THE_NAME
useradd --root $BASE_FOLDER --uid $THE_ID --gid $THE_ID --home-dir /home/$THE_NAME --create-home $THE_NAME
Getting error
useradd: group '70000' does not exist
checking the group file, the group exists:
grep aaaaa $BASE_FOLDER/
aaaaa:x:70000:
------
Description: Ubuntu 18.04.1 LTS
Release: 18.04
passwd:
Installed: 1:4.5-1ubuntu1
Candidate: 1:4.5-1ubuntu1
Version table:
*** 1:4.5-1ubuntu1 500
500 http://
100 /var/lib/