mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Explicitly create group pihole on installation
Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
parent
82dfcbcd83
commit
33d2163f19
1 changed files with 21 additions and 6 deletions
|
@ -1760,20 +1760,35 @@ create_pihole_user() {
|
||||||
else
|
else
|
||||||
# If the pihole user doesn't exist,
|
# If the pihole user doesn't exist,
|
||||||
printf "%b %b %s" "${OVER}" "${CROSS}" "${str}"
|
printf "%b %b %s" "${OVER}" "${CROSS}" "${str}"
|
||||||
|
local str="Checking for group 'pihole'"
|
||||||
|
printf " %b %s..." "${INFO}" "${str}"
|
||||||
|
if getent group pihole > /dev/null 2>&1; then
|
||||||
|
# group pihole exists
|
||||||
|
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||||
|
# then create and add her to the pihole group
|
||||||
local str="Creating user 'pihole'"
|
local str="Creating user 'pihole'"
|
||||||
printf "%b %b %s..." "${OVER}" "${INFO}" "${str}"
|
printf "%b %b %s..." "${OVER}" "${INFO}" "${str}"
|
||||||
# create her with the useradd command,
|
|
||||||
if getent group pihole > /dev/null 2>&1; then
|
|
||||||
# then add her to the pihole group (as it already exists)
|
|
||||||
if useradd -r --no-user-group -g pihole -s /usr/sbin/nologin pihole; then
|
if useradd -r --no-user-group -g pihole -s /usr/sbin/nologin pihole; then
|
||||||
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||||
else
|
else
|
||||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# add user pihole with default group settings
|
# group pihole does not exist
|
||||||
if useradd -r -s /usr/sbin/nologin pihole; then
|
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
|
local str="Creating group 'pihole'"
|
||||||
|
# if group can be created
|
||||||
|
if groupadd pihole; then
|
||||||
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||||
|
# create and add pihole user to the pihole group
|
||||||
|
local str="Creating user 'pihole'"
|
||||||
|
printf "%b %b %s..." "${OVER}" "${INFO}" "${str}"
|
||||||
|
if useradd -r --no-user-group -g pihole -s /usr/sbin/nologin pihole; then
|
||||||
|
printf "%b %b %s\\n" "${OVER}" "${TICK}" "${str}"
|
||||||
|
else
|
||||||
|
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
printf "%b %b %s\\n" "${OVER}" "${CROSS}" "${str}"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue