fix: set wg-data ownership to repo user in wg-init
Mount the repo root read-only (/repo) in wg-init and use `stat -c '%u:%g' /repo` to detect the host user automatically. chown is applied before chmod 700, so the directory is accessible without sudo on any machine regardless of UID. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ services:
|
||||
- SYS_MODULE
|
||||
volumes:
|
||||
- ./wg-data:/data
|
||||
- ./:/repo:ro
|
||||
- /lib/modules:/lib/modules:ro
|
||||
command:
|
||||
- /bin/sh
|
||||
@@ -12,6 +13,7 @@ services:
|
||||
- |
|
||||
modprobe ip6_tables 2>/dev/null || true
|
||||
modprobe ip6table_nat 2>/dev/null || true
|
||||
chown "$(stat -c '%u:%g' /repo)" /data
|
||||
chmod 700 /data
|
||||
restart: "no"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user