What does the Linux Permissions Calculator do?
The Linux Permissions Calculator (chmod Calculator) helps DevOps engineers, system administrators, and developers inspect, convert, and construct file permission modes on Linux/Unix systems. It provides interactive checkbox toggles, octal code inputs (e.g. 755, 644), 10-character symbolic notations (e.g. -rwxr-xr-x), special flag options (Setuid, Setgid, Sticky bit), and executable chmod CLI command strings.
Core Concepts
Understanding Linux File Permissions:
- Triplets: Permissions are assigned across 3 scopes: User (Owner), Group, and Others (World).
- Permission Digits:
- Read (
r) = 4 - Write (
w) = 2 - Execute (
x) = 1
- Read (
- Octal Code: Summing the values yields each digit. For example,
rwx= 4+2+1 =7,r-x= 4+0+1 =5. Thus755grants full permissions to owner, and read/execute to group and others. - Special Bits:
- Setuid (4000): Runs executable with file owner's privileges.
- Setgid (2000): New files created inside directory inherit the directory's group.
- Sticky Bit (1000): Prevents users from deleting files owned by others in shared directories (e.g.
/tmp).
How to use the tool?
- Select Preset or Checkboxes: Pick a common shortcut from Quick Permission Presets (like 755 or 644) or toggle Read, Write, and Execute checkboxes.
- Instant Conversion: The tool updates the 3-digit/4-digit octal code, symbolic string notation, and human readable explanation automatically.
- Copy Command: Click
Copyto grab the resultingchmod 755 file.txtcommand string.
Related Developer Utilities
If you work with Linux servers and shell scripts, explore these complementary tools:
- SSH Key Converter: Convert SSH private keys between OpenSSH, PEM, and PKCS#8 formats.
- Crontab to Systemd Timer: Convert 5-field cron jobs into native Systemd timer units.
REST API Integration
Blueutils provides a free REST API endpoint (POST https://blueutils.com/api/linux/chmod-calculator) to programmatically calculate octal permissions and symbolic strings.
API Request Parameters
| Name | Type | Description | Example |
|---|---|---|---|
octal |
String | (Optional) Octal string to convert (e.g. "755" or "0755"). |
"755" |
owner |
Object / Number | (Optional) Owner permissions { read, write, exec } or octal digit 7. |
{ "read": true, "write": true, "exec": true } |
group |
Object / Number | (Optional) Group permissions { read, write, exec } or octal digit 5. |
{ "read": true, "write": false, "exec": true } |
others |
Object / Number | (Optional) Others permissions { read, write, exec } or octal digit 5. |
{ "read": true, "write": false, "exec": true } |
isDirectory |
Boolean | (Optional) Sets leading character to 'd' instead of '-'. Default false. |
false |
filename |
String | (Optional) Filename for command formatting. Default "file.txt". |
"script.sh" |
API Request Payload Examples
cURL
curl -X POST https://blueutils.com/api/linux/chmod-calculator \
-H "Content-Type: application/json" \
-d '{
"octal": "755",
"filename": "script.sh"
}'Python
import requests
url = "https://blueutils.com/api/linux/chmod-calculator"
payload = {
"octal": "755",
"filename": "script.sh"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String jsonPayload = """
{
"octal": "755",
"filename": "script.sh"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://blueutils.com/api/linux/chmod-calculator"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}API Response Parameters
| Name | Type | Description | Example |
|---|---|---|---|
isValid |
Boolean | Indicates whether permission calculation succeeded. | true |
octal |
String | 3-digit octal permission code. | "755" |
symbolicNotation |
String | 10-character Linux symbolic notation string. | "-rwxr-xr-x" |
chmodCommand |
String | Formatted chmod shell command. |
"chmod 755 script.sh" |
humanReadable |
String | Plain-English summary of owner, group, and others rights. | "Owner: Read, Write, Execute | Group: Read, Execute | Others: Read, Execute" |
API Response Payload Examples
Success Response (HTTP 200 OK)
{
"isValid": true,
"octal": "755",
"octal4": "0755",
"symbolicNotation": "-rwxr-xr-x",
"chmodCommand": "chmod 755 script.sh",
"chmodRecursiveCommand": "chmod -R 755 script.sh",
"isDirectory": false,
"humanReadable": "Owner: Read, Write, Execute | Group: Read, Execute | Others: Read, Execute"
}Validation Failure Response (HTTP 400 Bad Request)
{
"isValid": false,
"error": "Invalid octal permissions '999'. Must be a 3 or 4-digit octal string (e.g., '755' or '0755')."
}Rate Limit Exceeded Response (HTTP 429 Too Many Requests)
{
"error": "API rate limit exceeded. Please wait or contact support@blueutils.com."
}Why use an API to calculate Linux Permissions?
Integrating the Permissions Calculator API into automation systems and CI/CD pipelines provides key benefits:
- Automated Deployment Validation: Validate octal permissions before executing shell provisioning scripts.
- Ansible & Terraform Integration: Automatically generate octal mode values for infrastructure file modules.
Native Usage
How to convert permissions programmatically across programming environments:
Node.js (JavaScript)
function octalToSymbolic(octal) {
const map = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx'];
return String(octal).split('').map(d => map[parseInt(d, 10)]).join('');
}
console.log('-' + octalToSymbolic('755'));Linux (Bash Shell)
#!/bin/bash
MODE="755"
FILE="script.sh"
chmod "$MODE" "$FILE"Python
def octal_to_symbolic(octal_str):
mapping = ['---', '--x', '-w-', '-wx', 'r--', 'r-x', 'rw-', 'rwx']
return '-' + ''.join(mapping[int(d)] for d in octal_str)
print(octal_to_symbolic('755'))Java
public class ChmodExample {
public static void main(String[] args) {
String[] map = {"---", "--x", "-w-", "-wx", "r--", "r-x", "rw-", "rwx"};
String octal = "755";
StringBuilder sb = new StringBuilder("-");
for (char c : octal.toCharArray()) {
sb.append(map[Character.getNumericValue(c)]);
}
System.out.println(sb.toString());
}
}