Skip to content

Commit b39e8db

Browse files
committed
Add SKIP_PERMISSIONS_CHECKS option (Strongly discouraged)
Resolves #163
1 parent 55182d6 commit b39e8db

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ Some variables are specific to Docker, and the default values are :
123123
* `PHP_TZ=UTC`
124124
* `STARTUP_DELAY=0`
125125

126+
Additionally, if `SKIP_PERMISSIONS_CHECKS` is set to "yes", the entrypoint script will not check or set the permissions of files and directories on startup. Users are strongly advised **against** using this option, and efforts have been made to keep the checks as fast as possible. Nonetheless, it may be suitable for some advanced use cases.
127+
126128
## Advanced configuration
127129

128130
Note that nginx will accept by default images up to 100MB (`client_max_body_size 100M`) and that PHP parameters are overridden according to the [recommendations of the Lychee FAQ](https://lycheeorg.github.io/docs/faq.html#i-cant-upload-large-photos).

entrypoint.sh

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,19 +137,23 @@ if [ ! "$(id -u "$USER")" -eq "$PUID" ]; then usermod -o -u "$PUID" "$USER" ; fi
137137
if [ ! "$(id -g "$USER")" -eq "$PGID" ]; then groupmod -o -g "$PGID" "$USER" ; fi
138138
echo -e " \tUser UID :\t$(id -u "$USER")"
139139
echo -e " \tUser GID :\t$(id -g "$USER")"
140+
usermod -a -G "$USER" www-data
140141

141142
echo "**** Make sure Laravel's log exists ****" && \
142143
touch /logs/laravel.log
143144

144-
echo "**** Set Permissions ****" && \
145-
# Set ownership of directories, then files and only when required. See LycheeOrg/Lychee-Docker#120
146-
find /sym /uploads /logs -type d \( ! -user "$USER" -o ! -group "$USER" \) -exec chown -R "$USER":"$USER" \{\} \;
147-
find /conf/.env /sym /uploads /logs \( ! -user "$USER" -o ! -group "$USER" \) -exec chown "$USER":"$USER" \{\} \;
148-
# Laravel needs to be able to chmod user.css and custom.js for no good reason
149-
find /conf/user.css /conf/custom.js /logs/laravel.log \( ! -user "www-data" -o ! -group "$USER" \) -exec chown www-data:"$USER" \{\} \;
150-
usermod -a -G "$USER" www-data
151-
find /sym /uploads /logs -type d \( ! -perm -ug+w -o ! -perm -ugo+rX -o ! -perm -g+s \) -exec chmod -R ug+w,ugo+rX,g+s \{\} \;
152-
find /conf/user.css /conf/custom.js /conf/.env /sym /uploads /logs \( ! -perm -ug+w -o ! -perm -ugo+rX \) -exec chmod ug+w,ugo+rX \{\} \;
145+
if [ -n "$SKIP_PERMISSIONS_CHECKS" ] && [ "${SKIP_PERMISSIONS_CHECKS,,}" = "yes" ] ; then
146+
echo "**** WARNING: Skipping permissions check ****"
147+
else
148+
echo "**** Set Permissions ****"
149+
# Set ownership of directories, then files and only when required. See LycheeOrg/Lychee-Docker#120
150+
find /sym /uploads /logs -type d \( ! -user "$USER" -o ! -group "$USER" \) -exec chown -R "$USER":"$USER" \{\} \;
151+
find /conf/.env /sym /uploads /logs \( ! -user "$USER" -o ! -group "$USER" \) -exec chown "$USER":"$USER" \{\} \;
152+
# Laravel needs to be able to chmod user.css and custom.js for no good reason
153+
find /conf/user.css /conf/custom.js /logs/laravel.log \( ! -user "www-data" -o ! -group "$USER" \) -exec chown www-data:"$USER" \{\} \;
154+
find /sym /uploads /logs -type d \( ! -perm -ug+w -o ! -perm -ugo+rX -o ! -perm -g+s \) -exec chmod -R ug+w,ugo+rX,g+s \{\} \;
155+
find /conf/user.css /conf/custom.js /conf/.env /sym /uploads /logs \( ! -perm -ug+w -o ! -perm -ugo+rX \) -exec chmod ug+w,ugo+rX \{\} \;
156+
fi
153157

154158
# Update CA Certificates if we're using armv7 because armv7 is weird (#76)
155159
if [[ $(uname -a) == *"armv7"* ]]; then

0 commit comments

Comments
 (0)