mirror of
https://github.com/nextcloud/docker.git
synced 2025-06-16 08:14:46 +02:00
Add env variables to change UID/GID of www-data
Signed-off-by: Jan Dittrich <mail@jand.one>
This commit is contained in:
parent
f87624c6eb
commit
bf1d80595b
14 changed files with 164 additions and 0 deletions
|
@ -43,6 +43,22 @@ file_env() {
|
||||||
unset "$fileVar"
|
unset "$fileVar"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# change uid/gid of www-data
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
CURRENT_UID=$(id -u www-data)
|
||||||
|
CURRENT_GID=$(id -g www-data)
|
||||||
|
if [ -n "${UID+x}" ] && [ "$UID" -ne $CURRENT_UID ]; then
|
||||||
|
echo "Change UID of www-data from $CURRENT_UID to $UID"
|
||||||
|
usermod -u $UID www-data
|
||||||
|
find / -xdev -user $CURRENT_UID -exec chown -h www-data {} \;
|
||||||
|
fi
|
||||||
|
if [ -n "${GID+x}" ] && [ "$GID" -ne $CURRENT_GID ]; then
|
||||||
|
echo "Change GID of www-data from $CURRENT_GID to $GID"
|
||||||
|
groupmod -g $GID www-data
|
||||||
|
find / -xdev -group $CURRENT_GID -exec chgrp -h www-data {} \;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if expr "$1" : "apache" 1>/dev/null; then
|
if expr "$1" : "apache" 1>/dev/null; then
|
||||||
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
|
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
|
||||||
a2disconf remoteip
|
a2disconf remoteip
|
||||||
|
|
|
@ -6,6 +6,7 @@ RUN set -ex; \
|
||||||
\
|
\
|
||||||
apk add --no-cache \
|
apk add --no-cache \
|
||||||
rsync \
|
rsync \
|
||||||
|
shadow \
|
||||||
; \
|
; \
|
||||||
\
|
\
|
||||||
rm /var/spool/cron/crontabs/root; \
|
rm /var/spool/cron/crontabs/root; \
|
||||||
|
|
|
@ -43,6 +43,22 @@ file_env() {
|
||||||
unset "$fileVar"
|
unset "$fileVar"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# change uid/gid of www-data
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
CURRENT_UID=$(id -u www-data)
|
||||||
|
CURRENT_GID=$(id -g www-data)
|
||||||
|
if [ -n "${UID+x}" ] && [ "$UID" -ne $CURRENT_UID ]; then
|
||||||
|
echo "Change UID of www-data from $CURRENT_UID to $UID"
|
||||||
|
usermod -u $UID www-data
|
||||||
|
find / -xdev -user $CURRENT_UID -exec chown -h www-data {} \;
|
||||||
|
fi
|
||||||
|
if [ -n "${GID+x}" ] && [ "$GID" -ne $CURRENT_GID ]; then
|
||||||
|
echo "Change GID of www-data from $CURRENT_GID to $GID"
|
||||||
|
groupmod -g $GID www-data
|
||||||
|
find / -xdev -group $CURRENT_GID -exec chgrp -h www-data {} \;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if expr "$1" : "apache" 1>/dev/null; then
|
if expr "$1" : "apache" 1>/dev/null; then
|
||||||
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
|
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
|
||||||
a2disconf remoteip
|
a2disconf remoteip
|
||||||
|
|
|
@ -43,6 +43,22 @@ file_env() {
|
||||||
unset "$fileVar"
|
unset "$fileVar"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# change uid/gid of www-data
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
CURRENT_UID=$(id -u www-data)
|
||||||
|
CURRENT_GID=$(id -g www-data)
|
||||||
|
if [ -n "${UID+x}" ] && [ "$UID" -ne $CURRENT_UID ]; then
|
||||||
|
echo "Change UID of www-data from $CURRENT_UID to $UID"
|
||||||
|
usermod -u $UID www-data
|
||||||
|
find / -xdev -user $CURRENT_UID -exec chown -h www-data {} \;
|
||||||
|
fi
|
||||||
|
if [ -n "${GID+x}" ] && [ "$GID" -ne $CURRENT_GID ]; then
|
||||||
|
echo "Change GID of www-data from $CURRENT_GID to $GID"
|
||||||
|
groupmod -g $GID www-data
|
||||||
|
find / -xdev -group $CURRENT_GID -exec chgrp -h www-data {} \;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if expr "$1" : "apache" 1>/dev/null; then
|
if expr "$1" : "apache" 1>/dev/null; then
|
||||||
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
|
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
|
||||||
a2disconf remoteip
|
a2disconf remoteip
|
||||||
|
|
|
@ -43,6 +43,22 @@ file_env() {
|
||||||
unset "$fileVar"
|
unset "$fileVar"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# change uid/gid of www-data
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
CURRENT_UID=$(id -u www-data)
|
||||||
|
CURRENT_GID=$(id -g www-data)
|
||||||
|
if [ -n "${UID+x}" ] && [ "$UID" -ne $CURRENT_UID ]; then
|
||||||
|
echo "Change UID of www-data from $CURRENT_UID to $UID"
|
||||||
|
usermod -u $UID www-data
|
||||||
|
find / -xdev -user $CURRENT_UID -exec chown -h www-data {} \;
|
||||||
|
fi
|
||||||
|
if [ -n "${GID+x}" ] && [ "$GID" -ne $CURRENT_GID ]; then
|
||||||
|
echo "Change GID of www-data from $CURRENT_GID to $GID"
|
||||||
|
groupmod -g $GID www-data
|
||||||
|
find / -xdev -group $CURRENT_GID -exec chgrp -h www-data {} \;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if expr "$1" : "apache" 1>/dev/null; then
|
if expr "$1" : "apache" 1>/dev/null; then
|
||||||
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
|
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
|
||||||
a2disconf remoteip
|
a2disconf remoteip
|
||||||
|
|
|
@ -6,6 +6,7 @@ RUN set -ex; \
|
||||||
\
|
\
|
||||||
apk add --no-cache \
|
apk add --no-cache \
|
||||||
rsync \
|
rsync \
|
||||||
|
shadow \
|
||||||
; \
|
; \
|
||||||
\
|
\
|
||||||
rm /var/spool/cron/crontabs/root; \
|
rm /var/spool/cron/crontabs/root; \
|
||||||
|
|
|
@ -43,6 +43,22 @@ file_env() {
|
||||||
unset "$fileVar"
|
unset "$fileVar"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# change uid/gid of www-data
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
CURRENT_UID=$(id -u www-data)
|
||||||
|
CURRENT_GID=$(id -g www-data)
|
||||||
|
if [ -n "${UID+x}" ] && [ "$UID" -ne $CURRENT_UID ]; then
|
||||||
|
echo "Change UID of www-data from $CURRENT_UID to $UID"
|
||||||
|
usermod -u $UID www-data
|
||||||
|
find / -xdev -user $CURRENT_UID -exec chown -h www-data {} \;
|
||||||
|
fi
|
||||||
|
if [ -n "${GID+x}" ] && [ "$GID" -ne $CURRENT_GID ]; then
|
||||||
|
echo "Change GID of www-data from $CURRENT_GID to $GID"
|
||||||
|
groupmod -g $GID www-data
|
||||||
|
find / -xdev -group $CURRENT_GID -exec chgrp -h www-data {} \;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if expr "$1" : "apache" 1>/dev/null; then
|
if expr "$1" : "apache" 1>/dev/null; then
|
||||||
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
|
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
|
||||||
a2disconf remoteip
|
a2disconf remoteip
|
||||||
|
|
|
@ -43,6 +43,22 @@ file_env() {
|
||||||
unset "$fileVar"
|
unset "$fileVar"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# change uid/gid of www-data
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
CURRENT_UID=$(id -u www-data)
|
||||||
|
CURRENT_GID=$(id -g www-data)
|
||||||
|
if [ -n "${UID+x}" ] && [ "$UID" -ne $CURRENT_UID ]; then
|
||||||
|
echo "Change UID of www-data from $CURRENT_UID to $UID"
|
||||||
|
usermod -u $UID www-data
|
||||||
|
find / -xdev -user $CURRENT_UID -exec chown -h www-data {} \;
|
||||||
|
fi
|
||||||
|
if [ -n "${GID+x}" ] && [ "$GID" -ne $CURRENT_GID ]; then
|
||||||
|
echo "Change GID of www-data from $CURRENT_GID to $GID"
|
||||||
|
groupmod -g $GID www-data
|
||||||
|
find / -xdev -group $CURRENT_GID -exec chgrp -h www-data {} \;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if expr "$1" : "apache" 1>/dev/null; then
|
if expr "$1" : "apache" 1>/dev/null; then
|
||||||
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
|
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
|
||||||
a2disconf remoteip
|
a2disconf remoteip
|
||||||
|
|
|
@ -43,6 +43,22 @@ file_env() {
|
||||||
unset "$fileVar"
|
unset "$fileVar"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# change uid/gid of www-data
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
CURRENT_UID=$(id -u www-data)
|
||||||
|
CURRENT_GID=$(id -g www-data)
|
||||||
|
if [ -n "${UID+x}" ] && [ "$UID" -ne $CURRENT_UID ]; then
|
||||||
|
echo "Change UID of www-data from $CURRENT_UID to $UID"
|
||||||
|
usermod -u $UID www-data
|
||||||
|
find / -xdev -user $CURRENT_UID -exec chown -h www-data {} \;
|
||||||
|
fi
|
||||||
|
if [ -n "${GID+x}" ] && [ "$GID" -ne $CURRENT_GID ]; then
|
||||||
|
echo "Change GID of www-data from $CURRENT_GID to $GID"
|
||||||
|
groupmod -g $GID www-data
|
||||||
|
find / -xdev -group $CURRENT_GID -exec chgrp -h www-data {} \;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if expr "$1" : "apache" 1>/dev/null; then
|
if expr "$1" : "apache" 1>/dev/null; then
|
||||||
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
|
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
|
||||||
a2disconf remoteip
|
a2disconf remoteip
|
||||||
|
|
|
@ -6,6 +6,7 @@ RUN set -ex; \
|
||||||
\
|
\
|
||||||
apk add --no-cache \
|
apk add --no-cache \
|
||||||
rsync \
|
rsync \
|
||||||
|
shadow \
|
||||||
; \
|
; \
|
||||||
\
|
\
|
||||||
rm /var/spool/cron/crontabs/root; \
|
rm /var/spool/cron/crontabs/root; \
|
||||||
|
|
|
@ -43,6 +43,22 @@ file_env() {
|
||||||
unset "$fileVar"
|
unset "$fileVar"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# change uid/gid of www-data
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
CURRENT_UID=$(id -u www-data)
|
||||||
|
CURRENT_GID=$(id -g www-data)
|
||||||
|
if [ -n "${UID+x}" ] && [ "$UID" -ne $CURRENT_UID ]; then
|
||||||
|
echo "Change UID of www-data from $CURRENT_UID to $UID"
|
||||||
|
usermod -u $UID www-data
|
||||||
|
find / -xdev -user $CURRENT_UID -exec chown -h www-data {} \;
|
||||||
|
fi
|
||||||
|
if [ -n "${GID+x}" ] && [ "$GID" -ne $CURRENT_GID ]; then
|
||||||
|
echo "Change GID of www-data from $CURRENT_GID to $GID"
|
||||||
|
groupmod -g $GID www-data
|
||||||
|
find / -xdev -group $CURRENT_GID -exec chgrp -h www-data {} \;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if expr "$1" : "apache" 1>/dev/null; then
|
if expr "$1" : "apache" 1>/dev/null; then
|
||||||
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
|
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
|
||||||
a2disconf remoteip
|
a2disconf remoteip
|
||||||
|
|
|
@ -43,6 +43,22 @@ file_env() {
|
||||||
unset "$fileVar"
|
unset "$fileVar"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# change uid/gid of www-data
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
CURRENT_UID=$(id -u www-data)
|
||||||
|
CURRENT_GID=$(id -g www-data)
|
||||||
|
if [ -n "${UID+x}" ] && [ "$UID" -ne $CURRENT_UID ]; then
|
||||||
|
echo "Change UID of www-data from $CURRENT_UID to $UID"
|
||||||
|
usermod -u $UID www-data
|
||||||
|
find / -xdev -user $CURRENT_UID -exec chown -h www-data {} \;
|
||||||
|
fi
|
||||||
|
if [ -n "${GID+x}" ] && [ "$GID" -ne $CURRENT_GID ]; then
|
||||||
|
echo "Change GID of www-data from $CURRENT_GID to $GID"
|
||||||
|
groupmod -g $GID www-data
|
||||||
|
find / -xdev -group $CURRENT_GID -exec chgrp -h www-data {} \;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if expr "$1" : "apache" 1>/dev/null; then
|
if expr "$1" : "apache" 1>/dev/null; then
|
||||||
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
|
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
|
||||||
a2disconf remoteip
|
a2disconf remoteip
|
||||||
|
|
|
@ -5,6 +5,7 @@ RUN set -ex; \
|
||||||
\
|
\
|
||||||
apk add --no-cache \
|
apk add --no-cache \
|
||||||
rsync \
|
rsync \
|
||||||
|
shadow \
|
||||||
; \
|
; \
|
||||||
\
|
\
|
||||||
rm /var/spool/cron/crontabs/root; \
|
rm /var/spool/cron/crontabs/root; \
|
||||||
|
|
|
@ -43,6 +43,22 @@ file_env() {
|
||||||
unset "$fileVar"
|
unset "$fileVar"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# change uid/gid of www-data
|
||||||
|
if [ "$(id -u)" = 0 ]; then
|
||||||
|
CURRENT_UID=$(id -u www-data)
|
||||||
|
CURRENT_GID=$(id -g www-data)
|
||||||
|
if [ -n "${UID+x}" ] && [ "$UID" -ne $CURRENT_UID ]; then
|
||||||
|
echo "Change UID of www-data from $CURRENT_UID to $UID"
|
||||||
|
usermod -u $UID www-data
|
||||||
|
find / -xdev -user $CURRENT_UID -exec chown -h www-data {} \;
|
||||||
|
fi
|
||||||
|
if [ -n "${GID+x}" ] && [ "$GID" -ne $CURRENT_GID ]; then
|
||||||
|
echo "Change GID of www-data from $CURRENT_GID to $GID"
|
||||||
|
groupmod -g $GID www-data
|
||||||
|
find / -xdev -group $CURRENT_GID -exec chgrp -h www-data {} \;
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if expr "$1" : "apache" 1>/dev/null; then
|
if expr "$1" : "apache" 1>/dev/null; then
|
||||||
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
|
if [ -n "${APACHE_DISABLE_REWRITE_IP+x}" ]; then
|
||||||
a2disconf remoteip
|
a2disconf remoteip
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue