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 +t sets sticky permissions, so nobody deletes the files of others

Permissions
~/tips/tip-permissions-sticky-bit-drop-folder

sudo chmod 1777 /srv/dropbox

Stops users from deleting each other's files in a folder everyone can write to.

Write access to a directory normally lets you delete any file in it. The sticky bit changes that.

sudo chmod 1777 /srv/dropbox
ls -ld /srv/dropbox    # drwxrwxrwt

With the t in the last column only the owner of a file, the owner of the directory and root can rename or delete it. That is how /tmp works. chmod +t sets the bit on an existing folder, and the leading 1 in 1777 does the same in octal. The bit does not stop other users from editing a file they have write access to.

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