====== DokuWiki Pages Directory Ownership Issue =====
===== Problem =====
After syncing wiki content from local to production via tar-over-SSH, DokuWiki displays the following error:
The datadir ('pages') at /app/www/public/data/pages is not found, isn't accessible or writable. You should check your config and permission settings. Or maybe you want to run the installer?
===== Root Cause =====
When transferring files from macOS to the Linux container via tar, the files retain the macOS user ID (UID 501) and group ID (dialout) instead of the container user (abc/users). The DokuWiki container runs as the abc user and cannot access files owned by UID 501.
Additionally, macOS creates ._ metadata files (resource forks) during tar operations, which clutter the directory.
===== Solution =====
**Fix ownership immediately:**
docker exec folkzone-wiki chown -R abc:users /config/dokuwiki/data/pages
**Remove macOS metadata files:**
docker exec folkzone-wiki find /config/dokuwiki/data/pages -name '._*' -delete
**Prevent recurrence with sync script:**
Use the sync-wiki.sh script which automatically handles ownership and metadata cleanup:
#!/bin/bash
WIKI_DIR="/Users/brennan/Documents/GitHub/homelab/folkzone-new/wiki-live"
SSH_KEY="$HOME/.omg-lol-keys/id_ed25519"
SSH_USER="brennan@192.168.1.65"
CONTAINER="folkzone-wiki"
CONTAINER_PATH="/config/dokuwiki/data/pages"
# Sync with COPYFILE_DISABLE to prevent macOS resource forks
COPYFILE_DISABLE=1 tar czf - -C "$WIKI_DIR" . | \
ssh -i "$SSH_KEY" "$SSH_USER" "docker exec -i $CONTAINER tar xzf - -C $CONTAINER_PATH"
# Fix ownership
ssh -i "$SSH_KEY" "$SSH_USER" "docker exec $CONTAINER chown -R abc:users $CONTAINER_PATH"
# Clean up macOS metadata files
ssh -i "$SSH_KEY" "$SSH_USER" "docker exec $CONTAINER find $CONTAINER_PATH -name '._*' -delete"
===== Prevention =====
Always use the sync-wiki.sh script instead of manual tar commands. The script:
1. Sets COPYFILE_DISABLE=1 to prevent macOS resource fork creation
2. Syncs content via tar
3. Automatically fixes ownership to abc:users
4. Automatically removes ._ metadata files
===== See Also =====
* [[folkzone:troubleshooting:start|Troubleshooting Index]]
* [[folkzone:services:wiki|DokuWiki Service]]
* [[meta:start|Wiki Maintenance]]
* [[folkzone:start|Return to folkzone]]