Search tools

Linux file permissions

chmod 666: what it means and when to use it

chmod 666 allows every local user to read and overwrite a file, without making it executable.

666 rw-rw-rw-
What chmod 666 allows for each class of user
WhoDigitRead WriteExecute
Owner 6 Yes Yes No
Group 6 Yes Yes No
Everyone else 6 Yes Yes No

How chmod 666 works

Each 6 enables read (4) and write (2) while leaving execute (1) off. Unlike 777, files cannot be invoked directly as executables, though any local account can tamper with their contents.

Outside special pseudo-devices such as /dev/null where world-writable non-executable access is required by design, 666 is almost always a red flag on normal application files.

Where 666 belongs

  • Checking whether legacy lock or device-node scripts opened permissions too wide
  • Short-lived local sandbox testing (never leave 666 in production)

The command

Both of these set exactly the same permissions. The number is shorter; the letters are easier to read back later.

chmod 666 filename
chmod u=rw,g=rw,o=rw filename

World-writable files let any compromised local user rewrite your app config or inject malicious payloads. Prefer 644 (or 664 with group ownership) instead.

Open 666 in the chmod calculator