File tree Expand file tree Collapse file tree 1 file changed +15
-14
lines changed
Expand file tree Collapse file tree 1 file changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -25,19 +25,20 @@ PGID="$3"
2525if [ -f /etc/alpine-release ]; then
2626 # Alpine
2727 addgroup -g " ${PGID} " " ${username} " && \
28- adduser -u " ${PUID} " -G " ${username} " -h " /home/${username} " -s /bin/sh -D " ${username} " && \
29- # Set account to expired but not locked
30- chage -E 0 " ${username} "
28+ adduser -u " ${PUID} " -G " ${username} " -h " /home/${username} " -s /bin/sh -D " ${username} "
3129else
3230 # Debian
33- addgroup --gid " ${PGID} " " ${username} " && \
34- adduser --uid " ${PUID} " \
35- --gid " ${PGID} " \
36- --home " /home/${username} " \
37- --shell /bin/bash \
38- --disabled-password \
39- --gecos ' ' \
40- " ${username} " && \
41- # Set a locked password that can't be used but keeps the account unlocked
42- usermod -p ' !' " ${username} "
43- fi
31+ groupadd -g " ${PGID} " " ${username} " && \
32+ useradd --no-log-init \
33+ -m \
34+ -s /bin/bash \
35+ -d " /home/${username} " \
36+ -u " ${PUID} " \
37+ -g " ${PGID} " \
38+ " ${username} "
39+ fi
40+
41+ # Set a proper password hash that allows SSH key auth but prevents password login
42+ # '*' allows the account to be active but prevents password login
43+ # This works the same way on both Alpine and Debian
44+ usermod -p ' *' " ${username} "
You can’t perform that action at this time.
0 commit comments