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 existing files keep their previous permission bits unless they are modified individually or altered with a recursive command.
The directory owner automatically loses write permission to any subdirectories it already contains.
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 'chmod' do in a POSIX-compliant file system?
Open an interactive chat with Bash
What does 'chmod -R' do?
Open an interactive chat with Bash
What is the difference between permission bits on a directory and its files?