brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: install -m sets permissions, owner and group while it copies the file

Permissions
~/tips/tip-permissions-install-m-owner-group

sudo install -m 640 -o root -g www-data app.env /etc/app/app.env

Copies a file and sets its mode, owner and group in one command.

Copy, chmod and chown in three commands leave a short moment when a secret file has the wrong permissions.

sudo install -m 640 -o root -g www-data app.env /etc/app/app.env
sudo install -d -m 750 -o app -g app /var/lib/app

install copies the file and sets the mode, owner and group you ask for in one command. -d makes a directory, parents included. It overwrites an existing file at the destination, so check the path first. I find it a good fit for deploy scripts and Dockerfiles.

Further reading: install manual page

More Permissions tips sudo su -s /bin/bash www-data sudo setfacl -R -d -m g:media:rwX /srv/media sudo cp -r /srv/site /srv/site.r ls -ln /srv/data newgrp media All Permissions tips (30) All topics

Link