GzGit in the Zone

Dictionary · Linux and Windows Commands

chmod

Files · Beginner

Changes permission bits on a Unix file or directory. The owner, the group, and everyone else can each be granted read, write, or execute.

Permissions are written as three digits. 6 means read and write, 4 means read, and 0 means no access. 640 gives the owner read and write, the group read, and others nothing.

Example: chmod 640 notes.txt lets the owner edit the file, the group read it, and everyone else ignore it.

Command

Platform: Linux and macOS

chmod 640 notes.txt

The first digit is the owner, the second is the group, and the third is everyone else. 6 is read/write, 4 is read-only, and 0 is no permission.

Common misconception

  • 777 is not a safe default. It lets every local account read, write, and execute the file.

Related terminology

Quiz this category