Use Unix Permissions Calculator

Enter your data below to use the Unix Permissions Calculator

📌 Try these examples:
RESULT

Last updated

Understanding Unix File Permissions

Unix file permissions control who can read, write, and execute files. Every file has three permission sets — owner, group, and others — each with three bits: read (r=4), write (w=2), execute (x=1). The Unix Permissions Calculator converts between symbolic and octal representations instantly.

Reading Symbolic Permissions

The output of ls -l shows symbolic permissions:

-rwxr-xr--  1 alice  developers  4096  Jan 15 08:20  script.sh

Position breakdown:
-           File type: - = regular file, d = directory, l = symlink
rwx         Owner (alice): read + write + execute
r-x         Group (developers): read + execute (no write)
r--         Others: read only (no write, no execute)

Octal to Symbolic Conversion

Each octal digit is the sum of permission bits (r=4, w=2, x=1):

Octal  Binary  Symbolic  Meaning
-----  ------  --------  -------
0      000     ---       No permissions
1      001     --x       Execute only
2      010     -w-       Write only
3      011     -wx       Write + execute
4      100     r--       Read only
5      101     r-x       Read + execute
6      110     rw-       Read + write
7      111     rwx       Read + write + execute

Common permission values:
755  →  rwxr-xr-x  (directories, executables)
644  →  rw-r--r--  (regular files)
600  →  rw-------  (private files, SSH keys)
777  →  rwxrwxrwx  (full access — avoid in production)
400  →  r--------  (read-only, e.g., config files)

chmod Command Generation

Enter desired permissions and get the chmod command automatically:

Target: rwxr-xr-x (755)

Octal form:
  chmod 755 filename

Symbolic form:
  chmod u=rwx,g=rx,o=rx filename

Relative form (add/remove bits):
  chmod +x filename          # add execute for all
  chmod g-w filename         # remove write from group
  chmod o-rwx filename       # remove all from others
  chmod u+x,g-w filename     # multiple changes at once

Common Permission Patterns

Permission  Octal  Use Case
----------  -----  --------
rwxr-xr-x   755   Web server directories, executable scripts
rw-r--r--   644   HTML, CSS, JS files, config files
rw-------   600   SSH private keys (~/.ssh/id_rsa)
rwx------   700   Private directories
r-xr-xr-x   555   Read-only shared executables
rw-rw-r--   664   Shared files (owner + group can write)
rwxrwxr-x   775   Shared directories (group collaboration)
----------  -----  --------

# Set web server file permissions
find /var/www/html -type f -exec chmod 644 {} \;
find /var/www/html -type d -exec chmod 755 {} \;

Special Permission Bits

A four-digit octal includes the special bits as the first digit:

Special bit  Octal  Symbolic  Effect
-----------  -----  --------  ------
Setuid       4000   s in owner execute  Run as file owner
Setgid       2000   s in group execute  Run as file group / inherit group
Sticky bit   1000   t in other execute  Only owner can delete (shared dirs)

Examples:
4755  →  rwsr-xr-x   Setuid executable (e.g., /usr/bin/passwd)
2755  →  rwxr-sr-x   Setgid directory (new files inherit group)
1777  →  rwxrwxrwt   Sticky bit (e.g., /tmp)

# Set sticky bit on shared directory
chmod 1777 /shared/uploads
chmod +t /shared/uploads

# Set setgid on project directory
chmod 2775 /var/www/project

Directory vs File Permissions

Permission  On a File              On a Directory
----------  ---------              --------------
r (read)    Read file contents     List directory contents (ls)
w (write)   Modify file contents   Create/delete files inside
x (execute) Run as program         Enter directory (cd), access files

# Without execute on directory:
ls /secret/     # Permission denied (can't list)
cat /secret/file.txt  # Permission denied (can't access)

# With read but no execute on directory:
ls /secret/     # Works (can list names)
cat /secret/file.txt  # Permission denied (can't access files)

Umask — Default Permission Mask

Umask subtracts bits from the default permissions:
  Default for files:       666 (rw-rw-rw-)
  Default for directories: 777 (rwxrwxrwx)

Common umask values:
  022  →  files: 644 (rw-r--r--), dirs: 755 (rwxr-xr-x)  [most common]
  027  →  files: 640 (rw-r-----), dirs: 750 (rwxr-x---)   [more secure]
  077  →  files: 600 (rw-------), dirs: 700 (rwx------)   [private]

# Check current umask
umask

# Set umask for session
umask 022

# Set umask permanently (add to ~/.bashrc)
echo "umask 022" >> ~/.bashrc

Recursive Permission Changes

# Fix web server permissions recursively
chmod -R 755 /var/www/html          # all files and dirs to 755
find /var/www -type f -exec chmod 644 {} \;  # files to 644
find /var/www -type d -exec chmod 755 {} \;  # dirs to 755

# Fix SSH directory permissions
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub
chmod 644 ~/.ssh/authorized_keys
chmod 644 ~/.ssh/known_hosts

Viewing and Verifying Permissions

# List permissions in detail
ls -la /var/www/html

# Show octal permissions
stat -c "%a %n" /var/www/html/*

# Find files with insecure permissions
find /var/www -perm -o+w -type f    # world-writable files
find /var/www -perm 777             # fully open files
find / -perm -4000 -type f          # setuid files

Quick Reference

Frequently Asked Questions

Simply enter your data, click the process button, and get instant results. All processing happens in your browser for maximum privacy and security.

Yes! Unix Permissions Calculator is completely free to use with no registration required. All processing is done client-side in your browser.

Absolutely! All processing happens locally in your browser. Your data never leaves your device, ensuring complete privacy and security.