I am trying to use unionfs to create multiple (100+) instances of a few development tools for our development server. Here is the script I am using:
PROJECT=$1
DEPLOYMENT=$2
TOOL=$3
DIR_TOOL="/var/www/tools/${TOOL}"
DIR_CONFIG="/var/www/tools-instances/${PROJECT}/${DEPLOYMENT}/${TOOL}/config"
DIR_TMP="/var/www/tools-instances/${PROJECT}/${DEPLOYMENT}/${TOOL}/tmp"
DIR_MERGED="/var/www/tools-instances/${PROJECT}/${DEPLOYMENT}/${TOOL}/merged"
mkdir -p "${DIR_CONFIG}"
mkdir -p "${DIR_TMP}"
mkdir -p "${DIR_MERGED}"
unionfs -o cow "${DIR_TMP}"=RW:"${DIR_CONFIG}"=RO:"${DIR_TOOL}"=RO "${DIR_MERGED}"
And then use it like this:
create-tool-overlay.sh "project-1" "staging" "phpmyadmin"
Everything works fine but only for our manager user.
If I try to access the folder as any other user including www-data (who needs this access) and root (who should have access to everything) I get permission denied.
And if I try to run ls on this folder I get this weird output:
root@app-1:/var/www/tools-instances/project-1/staging/phpmyadmin# ls -al
ls: cannot access 'merged': Permission denied
total 32
drwxrwxr-x+ 5 manager manager 4096 Dec 16 15:51 .
drwxrwxr-x+ 3 manager manager 4096 Dec 14 15:29 ..
drwxrwxr-x+ 2 manager manager 4096 Dec 14 15:29 config
d?????????? ? ? ? ? ? merged
drwxrwxr-x+ 2 manager manager 4096 Dec 16 15:51 tmp