Skip to content

Permissions

Tags: linux, permissions


Change permissions on a directory recursively without applying Execute to files

Using a large “X” applies execute to Directories but not files.

Terminal window
chmod -R u=rwX,g=rwX docker-compose-files/

Remove write from Other recursively

You can remove write (-w) from other (o)

chmod o-w -R /path

SetGID

Having an s in the permissions list of ls -al is the setgid bit. When another user creates a file or directory under such a setgid directory, the new file or directory will have its group set as the group of the directory’s owner, instead of the group of the user who creates it.

  • Add s with chmod g+s directory
  • Remove it with -s
Note

According to Sven Mascheck’s page on special permission bits, the u+s bit only has an effect on three non-Linux operating systems


Sources:
  • https://linuxize.com/post/chmod-command-in-linux/
  • https://superuser.com/questions/838616/what-does-chmod-us-directory-do