Toolsvana→Developer Tools→Chmod Calculator

Chmod Calculator

Calculate Linux file permissions in octal and symbolic notation

Permission Matrix

RoleRead (4)Write (2)Execute (1)Value
owneru6
groupg4
otherso4

Octal Notation

chmod 644 filename

Symbolic Notation

-rw-r--r--
-rw-r--r--(type/owner/group/others)

# Command Examples

$chmod 644 filename
$chmod -R 644 directory/

Common Permission Presets

πŸ›‘οΈUnderstanding Linux File Permissions

Linux file permissions control who can read, write, and execute files. Every file and directory has three permission sets: one for the owner, one for the group, and one for all other users.

The chmod command (change mode) is used to modify these permissions. You can use either octal notation (like 755) or symbolic notation (like rwxr-xr-x) to set permissions.

Permission Values Explained

4

Read (r)

View file contents or list directory contents.

2

Write (w)

Modify file contents or create/delete files in directory.

1

Execute (x)

Run file as program or enter directory.

Security Best Practices

βœ…Use 644 for regular files (owner write, everyone read)
βœ…Use 755 for directories and executable scripts
βœ…Use 600 for sensitive files (SSH keys, configs, .env)
βœ…Never use 777 in production - it's a security risk
βœ…Use 700 for private directories (home, .ssh)
βœ…Apply principle of least privilege always

Special Permissions (Setuid, Setgid, Sticky Bit)

Beyond the basic read, write, and execute permissions, Linux supports special permission bits that modify how programs run or how files are accessed:

Setuid (4xxx)

When set on an executable, it runs with the file owner's permissions. Example: /usr/bin/passwdruns as root to modify /etc/shadow.

Setgid (2xxx)

On files, runs with group permissions. On directories, new files inherit the directory's group instead of the creator's primary group.

Sticky Bit (1xxx)

On directories, only the file owner can delete their files. Used on /tmp to prevent users from deleting each other's temporary files.

Common Permission Scenarios

Web Server Files

HTML/CSS/JS files: 644. Directories: 755. Upload directories may need 775 with proper group ownership.

SSH Keys

Private keys: 600. Public keys: 644. ~/.ssh directory: 700. SSH will refuse to use keys with wrong permissions.

Shell Scripts

User scripts: 755 or 700. System scripts in /usr/local/bin: 755 with root ownership.

Configuration Files

General configs: 644. Sensitive configs with passwords: 600 or 640. Never world-readable for secrets.

πŸ›‘οΈ

Privacy & Cookies

We use cookies for analytics and ads to keep our tools free. You can customize your preferences.