You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding the username, password and sudo as argument is simple and very convenient.
Still, for more complicated setups, I would wish to define users and passwords as a list.
Further, in my case, predefined UIDs are important to ensure access to shared volumes.
Would you accept a PR to run this script (link) when /etc/users.list exists and go for the existing solution, with the arguments, in case the file is missing?
The text was updated successfully, but these errors were encountered:
It is a good idea, but all containers must be zero-config for all users. The additional config can be added if someone wants more functionality. It looks only need to add this test:
The users.list has the following format: id username password-hash list-of-supplemental-groups
E.g.: 1005 johndoe $1$6kLbPAuX$Wzw7rZNFedew3RLRCiXJb0 sudo
The following part would need to be added to your entrypoint script:
test -f /etc/users.list && {
while read id username hash groups; do
# Skip, if user already exists
grep ^$username /etc/passwd && continue
# Create group
addgroup --gid $id $username
# Create user
useradd -m -u $id -s /bin/bash -g $username $username
# Set password
echo "$username:$hash" | /usr/sbin/chpasswd -e
# Add supplemental groups
if [ $groups ]; then
usermod -aG $groups $username
fi
done < /etc/users.list
}
test -f /etc/users.list || {
# your user creation code
}
Adding the username, password and sudo as argument is simple and very convenient.
Still, for more complicated setups, I would wish to define users and passwords as a list.
Further, in my case, predefined UIDs are important to ensure access to shared volumes.
Would you accept a PR to run this script (link) when
/etc/users.list
exists and go for the existing solution, with the arguments, in case the file is missing?The text was updated successfully, but these errors were encountered: