Chmod Command Generator

Generate chmod, chown, and chgrp shell commands visually. Select permissions with a GUI and get the full command.

About This Tool

The Chmod Command Generator is a visual tool that helps you build complete chmod, chown, and chgrp shell commands without memorizing Unix permission syntax. Instead of manually calculating octal values or writing symbolic notation, you simply click checkboxes in a permission grid and the tool generates the ready-to-use command for you.

Unix-like systems (Linux, macOS, BSD) use a permission model with three roles: Owner (the user who created the file), Group (members of the file's group), and Others (everyone else). Each role can be granted read (r), write (w), and execute (x) access independently. These nine permission flags are represented as either a three-digit octal number (e.g., 755) or a symbolic string (e.g., rwxr-xr-x).

Beyond basic permissions, the tool also supports special permission bits: SUID (Set User ID), SGID (Set Group ID), and the sticky bit. SUID causes an executable to run with the permissions of the file owner, SGID runs it with the group's permissions (or makes new files in a directory inherit the directory's group), and the sticky bit prevents users from deleting files they don't own in a shared directory.

The tool generates both absolute commands (e.g., chmod 755 /path) and relative commands that add or remove specific permissions (e.g., chmod u+rwx,g+rx /path). You can also set the file path, toggle the -R recursive flag, and switch between the chmod, chown, and chgrp tabs to build ownership commands. All processing is entirely client-side — your data never leaves your browser.

How to Use

  1. Select the chmod, chown, or chgrp tab depending on which command you need.
  2. For chmod: click the checkboxes in the permission grid to set read, write, and execute permissions for Owner, Group, and Others.
  3. Optionally enable special permissions (SUID, SGID, Sticky bit) below the grid.
  4. Choose between Absolute mode (sets exact permissions with an octal number) or Relative mode (adds or removes specific permissions with +/- notation).
  5. Enter the file or directory path and toggle the Recursive (-R) switch if you want the command to apply to all files inside a directory.
  6. Use a common preset (755, 644, 777, etc.) to quickly set well-known permission combinations.
  7. Click Copy or press Ctrl+Shift+C to copy the generated command to your clipboard. Paste it into your terminal.

FAQ

What is the difference between chmod, chown, and chgrp?

chmod changes the permissions (read, write, execute) on a file or directory. chown changes the owner and optionally the group of a file. chgrp changes only the group ownership. All three are essential for managing file access on Unix-like systems.

What is the difference between absolute and relative chmod?

Absolute mode (e.g., chmod 755 file) sets the entire permission to an exact value, replacing whatever was set before. Relative mode (e.g., chmod u+x file) adds or removes specific permissions without affecting the others. Relative mode is useful when you want to grant execute permission without changing read/write settings.

When should I use the recursive (-R) flag?

Use -R when you want to apply the same permission or ownership change to a directory and all files and subdirectories inside it. For example, chmod -R 755 /var/www sets permissions on the web root and every file within. Be careful with recursive changes — applying execute permission to every file inside a directory may not be desired.

What do SUID, SGID, and sticky bit do?

SUID (Set User ID, octal 4000): When set on an executable, it runs with the file owner's permissions instead of the executing user's. SGID (Set Group ID, octal 2000): On executables, it runs with the file's group; on directories, new files inherit the directory's group. Sticky bit (octal 1000): On directories, only the file owner can delete or rename their own files, even if others have write access (commonly used on /tmp).

What permissions should I use for web server files?

A common setup is 755 for directories (owner can write, web server can read and traverse) and 644 for regular files (owner can write, web server can read). Configuration files with sensitive data (like database credentials) should use 600 (owner-only). Never use 777 in production, as it grants full access to every user on the system.

How is this different from the Chmod Calculator?

The Chmod Calculator focuses on converting between octal and symbolic permission notations. The Chmod Command Generator goes further: it generates the complete shell command including the file path, the -R recursive flag, and supports relative (add/remove) mode. It also includes tabs for chown and chgrp commands, making it a one-stop tool for all file permission and ownership changes.

Is my data sent to any server?

No. All command generation is performed entirely in your browser using client-side JavaScript. No data ever leaves your machine. You can verify this by checking your browser's network tab while using the tool.

Related Tools