Oh MyUtils

Chmod Calculator - Unix File Permission Calculator Online

Calculate Linux/Unix file permissions with an interactive matrix. Convert between octal (755, 644) and symbolic (rwxr-xr-x) chmod formats.

Permission Grid

Read (r)Write (w)Execute (x)#
Owner (u)
7
Group (g)
5
Others (o)
5
Special
SetUID
SetGID
Sticky

chmod Command

$ chmod 755 filename

Security

Caution

Others have execute or group has write+execute access

ls -l Preview

$ ls -l -rwxr-xr-x 1 user group 4096 Feb 13 10:00 filename

Common Presets

Frequently Asked Questions

What is chmod and what does it do?

chmod (change mode) is a Unix/Linux command used to change file and directory access permissions. It controls who can read, write, or execute a file. Permissions are set for three user classes: the file owner (user), the group, and all other users. Understanding chmod is essential for server security, web development, and system administration.

How do I use this chmod calculator tool?

Click checkboxes in the permission grid to toggle individual permissions for Owner, Group, and Others. Alternatively, type an octal value (e.g., 755) in the numeric input field. The tool instantly converts between octal notation, symbolic notation, and the visual grid. Copy the generated chmod command and paste it into your terminal. Use the preset buttons for common permission configurations like 644 or 755.

Is my data safe? Does it get sent to a server?

Absolutely safe. This chmod calculator runs 100% in your browser using client-side JavaScript. No data is ever transmitted to any server. All calculations use simple bitwise arithmetic performed locally. This means you can safely use it for any server configuration without privacy concerns.

What is the difference between octal and symbolic notation?

Octal notation uses numbers (e.g., 755) where each digit represents permissions for owner, group, and others respectively. Each digit is the sum of read (4), write (2), and execute (1). Symbolic notation uses letters (e.g., rwxr-xr-x) where r = read, w = write, x = execute, and - = no permission. Both represent the same permissions in different formats.

What do setuid, setgid, and sticky bit do?

These are special permission bits that modify how files and directories behave. SetUID (4000) makes an executable run with the file owner's privileges (e.g., passwd command). SetGID (2000) makes an executable run with the file's group privileges, and for directories causes new files to inherit the directory's group. Sticky Bit (1000) on a directory prevents users from deleting files they do not own (e.g., /tmp directory uses 1777).

What chmod value should I use for my web server files?

For most web servers: use 644 (rw-r--r--) for regular files (HTML, CSS, PHP) so the owner can edit and the web server can read. Use 755 (rwxr-xr-x) for directories and executable scripts. Never use 777 on a production server as it allows anyone to read, write, and execute, creating a major security vulnerability.

Why is chmod 777 dangerous?

chmod 777 grants read, write, and execute permissions to everyone — the owner, the group, and all other users on the system. This means any user or process can modify or delete the file, and any executable can be run by anyone. On a web server, this could allow attackers to inject malicious code. Use the most restrictive permissions that still allow your application to function correctly.

Code Examples

// Unix file permission calculator in JavaScript

const PERM = {
  OWNER_R: 0o400, OWNER_W: 0o200, OWNER_X: 0o100,
  GROUP_R: 0o040, GROUP_W: 0o020, GROUP_X: 0o010,
  OTHER_R: 0o004, OTHER_W: 0o002, OTHER_X: 0o001,
  SETUID:  0o4000, SETGID: 0o2000, STICKY: 0o1000,
};

function octalToSymbolic(octal) {
  const chars = [];
  chars.push(octal & PERM.OWNER_R ? 'r' : '-');
  chars.push(octal & PERM.OWNER_W ? 'w' : '-');
  if (octal & PERM.SETUID) {
    chars.push(octal & PERM.OWNER_X ? 's' : 'S');
  } else {
    chars.push(octal & PERM.OWNER_X ? 'x' : '-');
  }
  chars.push(octal & PERM.GROUP_R ? 'r' : '-');
  chars.push(octal & PERM.GROUP_W ? 'w' : '-');
  if (octal & PERM.SETGID) {
    chars.push(octal & PERM.GROUP_X ? 's' : 'S');
  } else {
    chars.push(octal & PERM.GROUP_X ? 'x' : '-');
  }
  chars.push(octal & PERM.OTHER_R ? 'r' : '-');
  chars.push(octal & PERM.OTHER_W ? 'w' : '-');
  if (octal & PERM.STICKY) {
    chars.push(octal & PERM.OTHER_X ? 't' : 'T');
  } else {
    chars.push(octal & PERM.OTHER_X ? 'x' : '-');
  }
  return chars.join('');
}

// Example usage
const perm = 0o755;
console.log(`Octal: ${perm.toString(8)}`);
console.log(`Symbolic: ${octalToSymbolic(perm)}`);
console.log(`Command: chmod ${perm.toString(8)} myfile.sh`);

Related Tools