# Unix Permissions Calculator

> Converts a Unix/Linux file mode between octal (755, 0644, 4755) and symbolic (rwxr-xr-x, -rw-r--r--, u=rwx,g=rx,o=rx) notation and explains the read/write/execute bits for owner, group and others plus the setuid, setgid and sticky bits.

- Calculator id: `unix-permissions` · Category: Developer & IT (`developer`) · Tool name: `convert_unix_permissions`
- Canonical page: https://tttkmbb.com/developer/unix-permissions · This document: https://tttkmbb.com/developer/unix-permissions.md · JSON definition: https://tttkmbb.com/developer/unix-permissions.json

## Purpose

Converts a Unix/Linux file mode between octal (755, 0644, 4755) and symbolic (rwxr-xr-x, -rw-r--r--, u=rwx,g=rx,o=rx) notation and explains the read/write/execute bits for owner, group and others plus the setuid, setgid and sticky bits.

**Use when:** You need the chmod command for a permission string seen in ls -l, or want to know what an octal mode such as 4755 grants.

**Do not use when:** You need ACLs (getfacl/setfacl), Windows NTFS permissions, or umask arithmetic (subtract the umask bits from 666/777 manually).

## Input

| Parameter | Type | Unit | Required | Description |
| --- | --- | --- | --- | --- |
| `mode` | string |  | required | Octal mode with 3 or 4 digits (755, 0644, 4755, 0o755), a 9-character symbolic string optionally preceded by a file-type character (rwxr-xr-x, -rw-r--r--, drwxr-sr-x), or chmod assignments (u=rwx,g=rx,o=rx). |

## Output

| Field | Type | Unit | Description |
| --- | --- | --- | --- |
| `octal` | string |  | Three digits, or four when setuid/setgid/sticky are set (e.g. 4755). |
| `symbolic` | string |  | Nine characters as shown by ls -l (s/S and t/T mark the special bits). |
| `owner` | string |  | Permissions of the file owner. |
| `group` | string |  | Permissions of the owning group. |
| `others` | string |  | Permissions of everyone else. |
| `setuid` | boolean |  | Executable runs with the owner's user id (octal 4000). |
| `setgid` | boolean |  | Executable runs with the group id; new files in a directory inherit its group (octal 2000). |
| `sticky` | boolean |  | Only a file's owner may delete or rename it inside the directory (octal 1000). |
| `chmod_command` | string |  | Equivalent chmod command with the octal mode. |
| `chmod_symbolic` | string |  | Equivalent chmod command using u=, g=, o= assignments. |
| `explanation` | string |  | How each octal digit is built from read (4), write (2) and execute (1). |

## Formula

`digit = 4·read + 2·write + 1·execute for owner, group, others; special digit = 4·setuid + 2·setgid + 1·sticky; mode = special·512 + owner·64 + group·8 + others`

Follows the POSIX mode bits as documented in the GNU coreutils manual; an uppercase S or T in a symbolic string means the special bit is set without the corresponding execute bit.

## Data Sources

- GNU coreutils manual – chmod: Change access permissions — https://www.gnu.org/software/coreutils/manual/html_node/chmod-invocation.html (reference, retrieved 2026-09-24)
- GNU coreutils manual – File permissions (mode bits, numeric modes) — https://www.gnu.org/software/coreutils/manual/html_node/File-permissions.html (reference, retrieved 2026-09-24)

Data freshness: `static`. Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output.

## API

- `GET https://tttkmbb.com/api/v1/calculate/unix-permissions?mode=…`
- `POST https://tttkmbb.com/api/v1/calculate/unix-permissions` with JSON body `{"inputs": {…}}`
- Response: unified envelope (`success`, `request`, `result.values`, `result.units`, `sources`, `freshness`, `timestamp`, `next_actions`, `links`); see https://tttkmbb.com/docs/response-format.md
- Schema: https://tttkmbb.com/api/v1/calculators/unix-permissions · OpenAPI operationId `convert_unix_permissions` in https://tttkmbb.com/openapi.json
- Authentication: none. Rate limit: fair use, see https://tttkmbb.com/docs/rate-limits.md.

## MCP

- Server: `https://tttkmbb.com/mcp` (Streamable HTTP, JSON-RPC 2.0, no auth)
- Tool:  `run_calculator` with `{"calculator_id": "unix-permissions", "inputs": {…}}`

## Example

- 755: inputs `{"mode":"755"}` → `{"octal":"755","symbolic":"rwxr-xr-x","owner":"read, write, execute","group":"read, execute","others":"read, execute","setuid":false,"chmod_command":"chmod 755 file","chmod_symbolic":"chmod u=rwx,g=rx,o=rx file"}`
- rw-r--r--: inputs `{"mode":"rw-r--r--"}` → `{"octal":"644","symbolic":"rw-r--r--","owner":"read, write","group":"read","others":"read","sticky":false,"chmod_command":"chmod 644 file"}`

```
GET https://tttkmbb.com/api/v1/calculate/unix-permissions?mode=755
```

## Limitations

You need ACLs (getfacl/setfacl), Windows NTFS permissions, or umask arithmetic (subtract the umask bits from 666/777 manually). Follows the POSIX mode bits as documented in the GNU coreutils manual; an uppercase S or T in a symbolic string means the special bit is set without the corresponding execute bit. All values are computed from the formula above; no measurement or live data is involved.

## FAQ

**What does the leading digit in 4755 mean?**

The fourth (leading) digit holds the special bits: 4 = setuid, 2 = setgid, 1 = sticky. 4755 is rwsr-xr-x: everyone can run the program with the owner's privileges, as with /usr/bin/passwd.

**What is the difference between 755 and 0755?**

None; the leading 0 is the C/shell octal prefix. 0o755 (JavaScript/Python style) is accepted too.

**Why does ls show a capital S or T?**

A capital letter means the special bit is set but the execute bit in that position is not (e.g. rw-r-Sr-- = 2644), which is usually a mistake.

## Related

- [Number Base Converter](https://tttkmbb.com/math/base-converter.md) — Octal ↔ binary arithmetic behind the mode bits.
- [Bitwise Operations Calculator](https://tttkmbb.com/developer/bitwise-operations.md) — Mode bits are combined with AND/OR masks.
