-
Notifications
You must be signed in to change notification settings - Fork 252
Open
Description
Running this script:
#!/bin/sh
echo '## /etc/nsswitch.conf subid entry'
grep subid: /etc/nsswitch.conf
echo '## Working cases'
echo '# A. useradd, no /etc/subuid /etc/subgid'
rm -f /etc/subuid /etc/subgid
useradd -u 1000 -c DeleteMe -d /tmp/xxx -s /bin/nologin xxx
getsubids xxx
echo '# B. userdel, no /etc/subuid /etc/subgid'
rm -f /etc/subuid /etc/subgid
userdel -r xxx
echo '# C. newusers, with /etc/subuid /etc/subgid'
touch /etc/subuid /etc/subgid
echo 'xxx::1000::DeleteMe:/tmp/xxx:/bin/nologin' | newusers
getsubids xxx
echo '## Non-working cases'
echo '# D. userdel, with /etc/subuid /etc/subgid'
touch /etc/subuid /etc/subgid
userdel -r xxx
echo '# Cleanup non-working D'
rm -f /etc/subuid /etc/subgid
userdel xxx
echo '# E. useradd, with /etc/subuid /etc/subgid'
touch /etc/subuid /etc/subgid
useradd -u 1000 -c DeleteMe -d /tmp/xxx -s /bin/nologin xxx
Gives (where the maximal nss-module is similar to #819 ( shadow_subid_free method added):
## /etc/nsswitch.conf subid entry
subid: maximal
## Working cases
# A. useradd, no /etc/subuid /etc/subgid
useradd: warning: the home directory /tmp/xxx already exists.
useradd: Not copying any file from skel directory into it.
0: xxx 65536000 65536
# B. userdel, no /etc/subuid /etc/subgid
# C. newusers, with /etc/subuid /etc/subgid
0: xxx 65536000 65536
## Non-working cases
# D. userdel, with /etc/subuid /etc/subgid
userdel: cannot remove entry 1000 from /etc/subuid
# Cleanup non-working D
# E. useradd, with /etc/subuid /etc/subgid
useradd: failed to prepare the new /etc/subuid entry
Since newusers handles that case, I guess duplicating want_subgids/want_subuids to useradd/userdel should be the preferred way?
Metadata
Metadata
Assignees
Labels
No labels