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: chmod g=u gives the group the same permissions as the owner

Permissions
~/tips/tip-permissions-chmod-g-equals-u

chmod g=u,o= notes.txt

Copies the owner's permission bits to the group and clears them for others.

The symbolic form of chmod can copy bits from one class to another, which octal cannot express.

chmod g=u,o= notes.txt
ls -l notes.txt

g=u sets the group permissions to whatever the owner has, and o= clears everything for others. The letters u, g and o on the right side mean “copy from this class”. The result follows the file: with 640 it becomes 660, with 700 it becomes 770. That makes it safe in a script where files have different modes.

Further reading: chmod 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