Skip to content

Commit

Permalink
Allow changing of umask via -e UMASK=XXX
Browse files Browse the repository at this point in the history
  • Loading branch information
tribut committed Oct 1, 2019
1 parent eead0b6 commit 6941fd9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,22 @@ Then just pass the appropriate `--user` flag and the script to the `docker run`

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

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`)!

### Default file permissions

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).

For example, to allow write access for the group, add `-e UMASK=007` to your `docker run` call.

### Docker Compose

If you are running Docker Compose, you have to adds these parameters to your `docker-compose.yml` file instead:

user: '1000:1000'
command: '/config/docker/run'

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`)!
environment:
- UMASK=007

## Support

Expand Down
5 changes: 5 additions & 0 deletions run
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ log(){ echo "$*" >&2; }

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

if [ -n "$UMASK" ]; then
log "Setting umask to $UMASK"
umask "$UMASK"
fi

log "Initializing venv in $VENV"
python3 -m venv --system-site-packages "$VENV"
. "$VENV/bin/activate"
Expand Down

0 comments on commit 6941fd9

Please sign in to comment.