Skip to content

Commit 6837625

Browse files
authored
Merge pull request #41 from UCEAP/copilot/fix-umask-issue
Fix umask configuration to enable group-writable files
2 parents c7db3d4 + 6a7cb83 commit 6837625

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
FROM mcr.microsoft.com/devcontainers/php:8.3
22

33
# Change default umask and add user to web group so we can share write permission on web files
4-
RUN sed -i 's/^UMASK\s*022/UMASK 002/' /etc/login.defs
4+
# Configure pam_umask to set umask to 002 (works regardless of /etc/login.defs content)
5+
RUN sed -i 's/pam_umask\.so/pam_umask.so umask=002/' /etc/pam.d/common-session \
6+
&& sed -i 's/pam_umask\.so/pam_umask.so umask=002/' /etc/pam.d/common-session-noninteractive
57
RUN usermod -aG www-data vscode
68

79
# Add glow for formatting command usage output (and because it's just nice)
@@ -57,6 +59,9 @@ RUN sed -i 's/Listen\s*80$/# Listen 80/' /etc/apache2/ports.conf
5759
# Enable Apache modules
5860
RUN a2enmod expires headers rewrite
5961

62+
# Set umask for Apache to ensure group-writable files
63+
RUN echo "umask 002" >> /etc/apache2/envvars
64+
6065
# Install terminus
6166
RUN curl -L https://github.com/pantheon-systems/terminus/releases/latest/download/terminus.phar --output /usr/local/bin/terminus \
6267
&& chmod +x /usr/local/bin/terminus \

local/etc/uceap.d/refresh_content.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ function refresh_content() {
1818
# no-same-permissions doesn't seem to work so we fix it here
1919
sudo find web/sites/default/files -type d -exec chmod g+ws {} +
2020
sudo find web/sites/default/files -type f -exec chmod g+w {} +
21+
# TODO: Temporary workaround for umask issue - remove once Dockerfile umask fix is verified
22+
chmod -R g+w web/sites/default/files
2123

2224
db-rebuild.sh $DATABASE_BACKUP
2325

0 commit comments

Comments
 (0)