Search GimmeJob

Type at least 2 characters. Enter also searches by meaning.
QA interview question
InfrastructureMiddleOccasionalTheory

How do Linux file permissions work, and what do `chmod` and `chown` change?

Answer

Linux permissions are evaluated for file owner, group and others, with read, write and execute bits. `chmod` changes permission bits, while `chown` changes ownership. Numeric modes such as 644 and 755 are compact representations: 644 is typically read/write for owner and read-only for others; 755 additionally gives execute permission to group and others.

Strong answer includes

  • owner, group and others are separate permission classes
  • chmod changes mode while chown changes ownership
  • can explain common numeric modes without recommending 777

Practical example

If a deployed script exists but returns `Permission denied`, inspect `ls -l` first. A correct fix may be `chmod u+x run-tests.sh`; blindly using `chmod -R 777` changes far more permissions than the problem requires.

#linux#permissions#chmod#chown

Sources

GNU Coreutils manualGNU Project · Linux and Unix-like filesystem, text, disk-usage and shell utility behaviorLinux man-pages projectman7.org / Linux man-pages project · Linux processes, signals, networking and system-call-facing command behavior50 Linux Interview Questions (With Answers)Toolmingo · Recurrence signal for Linux filesystem, permissions, processes, systemd, networking and shell-command interview topics