Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add uid/gid modification to match hosts uid/gid #1401

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ RUN apk add --no-cache \
coreutils \
procps \
ncurses \
shadow \
binutils \
tzdata

Expand Down
24 changes: 24 additions & 0 deletions src/bash_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,30 @@ setup_web_password() {
fi
}

modifyUser()
{
declare username=${1:-} newId=${2:-}
[[ -z ${username} || -z ${newId} ]] && return

local currentId=$(id -u ${username})
[[ ${currentId} -eq ${newId} ]] && return

echo " [i] Changing ID for user: ${username} (${currentId} => ${newId})"
usermod -o -u ${newId} ${username}
}

modifyGroup()
{
declare groupname=${1:-} newId=${2:-}
[[ -z ${groupname} || -z ${newId} ]] && return

local currentId=$(id -g ${groupname})
[[ ${currentId} -eq ${newId} ]] && return

echo " [i] Changing ID for group: ${groupname} (${currentId} => ${newId})"
groupmod -o -g ${newId} ${groupname}
}

# setup_blocklists() {
# # Exit/return early without setting up adlists with defaults for any of the following conditions:
# # 1. skip_setup_blocklists env is set
Expand Down
2 changes: 2 additions & 0 deletions src/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ fi
# shellcheck source=/dev/null
. /usr/bin/bash_functions.sh

modifyUser pihole ${PIHOLE_UID}
modifyGroup pihole ${PIHOLE_GID}

# shellcheck source=/dev/null
# SKIP_INSTALL=true . /etc/.pihole/automated\ install/basic-install.sh
Expand Down