Skip to content

Commit 6941fd9

Browse files
committed
Allow changing of umask via -e UMASK=XXX
1 parent eead0b6 commit 6941fd9

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,22 @@ Then just pass the appropriate `--user` flag and the script to the `docker run`
1818

1919
docker run --init -d --name="home-assistant" -e "TZ=America/New_York" -v /PATH_TO_YOUR_CONFIG:/config --net=host --user 1000:1000 homeassistant/home-assistant:stable /config/docker/run
2020

21+
You must make sure the user you select can **write to your configuration directory** (`/PATH_TO_YOUR_CONFIG`) and has **access to your additional devices** (if applicable, anything made available using `docker run [...] --device`)!
22+
23+
### Default file permissions
24+
25+
If you need the files created by Home Assistant to be writeable by the group or everyone, you can customize the default permissions using the environment variable `UMASK` (see [umask (Wikipedia)](https://en.wikipedia.org/wiki/Umask) for an explanation).
26+
27+
For example, to allow write access for the group, add `-e UMASK=007` to your `docker run` call.
28+
29+
### Docker Compose
30+
2131
If you are running Docker Compose, you have to adds these parameters to your `docker-compose.yml` file instead:
2232

2333
user: '1000:1000'
2434
command: '/config/docker/run'
25-
26-
In any case you must make sure the user you select can **write to your configuration directory** (`/PATH_TO_YOUR_CONFIG`) and has **access to your additional devices** (if applicable, anything made available using `docker run [...] --device`)!
35+
environment:
36+
- UMASK=007
2737

2838
## Support
2939

run

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ log(){ echo "$*" >&2; }
77

88
log "Running as $(id -u):$(id -g)"
99

10+
if [ -n "$UMASK" ]; then
11+
log "Setting umask to $UMASK"
12+
umask "$UMASK"
13+
fi
14+
1015
log "Initializing venv in $VENV"
1116
python3 -m venv --system-site-packages "$VENV"
1217
. "$VENV/bin/activate"

0 commit comments

Comments
 (0)