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: directory permissions 711 let users enter a folder but not list it

Permissions
~/tips/tip-permissions-directory-x-versus-r

chmod 711 /tmp/demo

Explains the directory execute and read bits, and how 711 allows access without listing.

On a directory the execute bit does not mean running anything. It means passing through.

mkdir /tmp/demo && echo hi > /tmp/demo/secret.txt
chmod 711 /tmp/demo
sudo -u nobody ls /tmp/demo               # Permission denied
sudo -u nobody cat /tmp/demo/secret.txt   # prints hi

The owner still has full access. With x alone another user can open a file in the directory if they know its name and the file itself allows it, but cannot list the directory. That is handy for a home folder that serves a web directory inside it, chmod 711 /home/alice. Without x nothing inside can be reached, whatever the permissions on the files are.

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