File.chmod

You're seeing just the function chmod, go back to File module for more information.

Specs

chmod(Path.t(), non_neg_integer()) :: :ok | {:error, posix()}

Changes the mode for a given file.

Returns :ok on success, or {:error, reason} on failure.

Permissions

File permissions are specified by adding together the following octal modes:

  • 0o400 - read permission: owner

  • 0o200 - write permission: owner

  • 0o100 - execute permission: owner

  • 0o040 - read permission: group

  • 0o020 - write permission: group

  • 0o010 - execute permission: group

  • 0o004 - read permission: other

  • 0o002 - write permission: other

  • 0o001 - execute permission: other

For example, setting the mode 0o755 gives it write, read and execute permission to the owner and both read and execute permission to group and others.