When you use chmod to change only the permission bits on a directory (for example, chmod 750 /projects) in a typical POSIX-compliant file system, what happens to the permissions of the files that already exist inside that directory?
The directory owner automatically loses write permission to any subdirectories it already contains.
The existing files keep their previous permission bits unless they are modified individually or altered with a recursive command.
Newly created files in the directory are forced to 750 and ignore the creating user's umask.
All existing files immediately inherit the new 750 permissions from the directory.
Changing a directory's mode bits with chmod affects the directory object itself. The permission bits of files already stored in that directory remain whatever they were before the command was run. They will only change if you alter them individually, use a recursive option such as chmod -R, or rely on other mechanisms (ACLs, setgid inheritance, umask on newly created files, and so on).
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does it mean for permissions to be inherited in a directory?
Open an interactive chat with Bash
What are the different types of file permissions?
Open an interactive chat with Bash
How do I change file permissions in a Linux environment?