chmod 600 Explained — Owner-Only Read-Write
Understand the 600 permission in Linux. Only the file owner can read and write; no access for group or others. Essential for private keys and sensitive files.
Detailed Explanation
What Does chmod 600 Mean?
Permission 600 is the most restrictive commonly used permission that still allows the owner to work with the file:
| Role | Octal | Symbolic | Permissions |
|---|---|---|---|
| Owner | 6 | rw- | Read + Write |
| Group | 0 | --- | No access |
| Others | 0 | --- | No access |
Why 600 Matters
This permission is critical for files containing sensitive data. Without it, other users on the system could potentially read confidential information.
SSH Key Requirements
SSH is particularly strict about permissions. If your private key file has permissions broader than 600, SSH will refuse to use it:
# Set correct permissions for SSH private key
chmod 600 ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_ed25519
# SSH error when permissions are too open:
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
# @ WARNING: UNPROTECTED PRIVATE KEY FILE! @
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
# Permissions 0644 for '/home/user/.ssh/id_rsa' are too open.
Other Files That Need 600
# Database credentials
chmod 600 /etc/mysql/my.cnf
# Application secrets
chmod 600 .env
chmod 600 wp-config.php
# SSH authorized_keys
chmod 600 ~/.ssh/authorized_keys
# PGP/GPG private keys
chmod 600 ~/.gnupg/private-keys-v1.d/*
600 vs 400
Permission 400 (read-only for owner) provides even more protection by preventing accidental modification. Use 400 for files that should never be edited after creation, like deployed SSL certificates.
Use Case
Use 600 for SSH private keys, API credentials, .env files, database connection strings, WordPress wp-config.php, and any file containing passwords, tokens, or secret keys. This is a security best practice enforced by many tools including SSH and PGP.
Try It — Linux Permission Reference
Related Topics
chmod 644 Explained — Owner Read-Write, Others Read-Only
Common Permissions
chmod 400 Explained — Owner Read-Only Permission
SSH & Security
SSH Key File Permissions — Complete Guide
SSH & Security
chmod 700 Explained — Owner-Only Full Access
Common Permissions
Permissions for Sensitive Files — Passwords, Keys, and Secrets
SSH & Security