chmod 600 filename gives the file owner read and write access while removing ordinary group and other permissions. For a regular Linux file, the resulting mode is -rw-------: owner rw-, group ---, others ---.
Use it for an SSH private key, a personal credential file, or an .env file read by its owner. But 600 is a file mode, not encryption—and it is usually wrong for a directory. This guide shows how to verify the change, reproduce an OpenSSH key-permission warning, and handle the Windows equivalent correctly.
Platform note: Unless marked otherwise, commands use a Linux shell. macOS uses the BSD stat syntax shown above. Examples use disposable files and keys rather than production credentials.
What does chmod 600 mean?
chmod means change mode. The three digits in 600 are octal permissions for the owning user, group, and everyone else, in that order. In each digit, read is 4, write is 2, and execute is 1.
The leading dash in -rw------- indicates a regular file; the following nine characters describe its owner, group, and other permission bits. A directory with those same mode bits would appear as drw-------.
What it does not do: chmod 600 does not change the file's owner, encrypt its contents, revoke an already leaked key, or block root and other appropriately privileged processes. Access-control lists and other security policies can also affect access.
For the exact behavior of numeric and symbolic modes, see the GNU Coreutils chmod documentation.
How to use chmod 600 and verify it
Testing note: The terminal screenshots were captured for the original guide before the ShadeTerm rebrand. Legacy working-directory names are preserved in the recorded commands so they match the screenshots.
Do not change a real secret simply to learn the syntax. Create a harmless test file and record its permissions before and after:
mkdir -p ~/sshflow-chmod-lab
printf 'demo only\n' > ~/sshflow-chmod-lab/notes.txt
chmod 644 ~/sshflow-chmod-lab/notes.txt
ls -l ~/sshflow-chmod-lab/notes.txt
chmod 600 ~/sshflow-chmod-lab/notes.txt
ls -l ~/sshflow-chmod-lab/notes.txt
stat -c '%a %U %G %n' ~/sshflow-chmod-lab/notes.txt
The command changes the ordinary permissions from -rw-r--r-- (644) to -rw------- (600). The final check reports the numeric mode and file ownership on GNU/Linux. On macOS the equivalent is stat -f '%Lp %Su %Sg %N' filename.

chmod 600, with the owner and numeric mode verified using stat.Does chmod 0600 mean the same thing?
Yes, for an ordinary file's owner/group/other permission bits. 0600 is the four-digit spelling; the additional leading zero is conventional in some APIs and documentation. The following commands express owner read/write with no group/other permissions:
chmod 600 filename
chmod 0600 filename
chmod u=rw,go= filename
chmod go-rwx filename is not quite the same operation: it removes group and other access but does not add owner read/write access if either was missing. Special mode bits also require their own care on some filesystems.
chmod 600 for SSH private keys: reproduce the warning
SSH private keys are the most common real-world reason to set mode 600. OpenSSH can refuse to load a personal private key when group or other users are able to read it. Depending on the OpenSSH version and command, the error may include WARNING: UNPROTECTED PRIVATE KEY FILE!, bad permissions or This private key will be ignored.
The check happens on the client machine. The remote SSH server cannot inspect permissions on your local ~/.ssh/id_ed25519 or a downloaded .pem key.
Reproducible test using a disposable Ed25519 key
This test does not contact a server or use any existing credential. It generates a throwaway Ed25519 key and uses ssh-keygen -y to test whether the local private key can be loaded. Run it in a fresh lab directory; generating the key again at the same path will prompt before overwriting it.
mkdir -p ~/sshflow-chmod-lab
chmod 700 ~/sshflow-chmod-lab
ssh-keygen -q -t ed25519 -N '' \
-f ~/sshflow-chmod-lab/demo_ed25519
chmod 644 ~/sshflow-chmod-lab/demo_ed25519
stat -c '%a %n' ~/sshflow-chmod-lab/demo_ed25519
ssh-keygen -y -f ~/sshflow-chmod-lab/demo_ed25519 >/dev/null
printf 'Exit code with 644: %s\n' "$?"
chmod 600 ~/sshflow-chmod-lab/demo_ed25519
stat -c '%a %n' ~/sshflow-chmod-lab/demo_ed25519
ssh-keygen -y -f ~/sshflow-chmod-lab/demo_ed25519 >/dev/null
printf 'Exit code with 600: %s\n' "$?"
Run the test once as a regular, non-root user on a local Unix filesystem. On typical OpenSSH builds, the 644 case prints a permissions warning and returns a nonzero exit code; after changing to 600, ssh-keygen -y can read the valid key and returns zero. This checks local key loading only—not authentication to any SSH server. Warning text may differ by version.

600 and the same check is repeated. The command results—not a simulated message—are shown.For a real key after checking ownership and the correct path, the usual fix is:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_ed25519
# Or for a separately downloaded private key:
chmod 600 ~/Downloads/server.pem
Is 400 also valid? In many OpenSSH private-key workflows, yes: 400 allows the owner to read but not write the file, while 600 adds owner write permission. Neither grants group or other users ordinary file access.
If the key may already have been copied by someone untrusted, fixing the mode is not enough: replace the key and remove the old public key from authorized servers. For additional SSH-specific cases, read SSH key permissions and Permission denied (publickey).
When to use chmod 600: .ssh, config, authorized_keys and .env
Use mode 600 when the owning account should read and write the file and other ordinary accounts should not. Whether it works depends on the user that actually accesses the file.
| Path or file | Typical mode | Reason |
|---|---|---|
~/.ssh/ | 700 | Directory needs owner execute/search permission |
~/.ssh/id_ed25519 | 600 or 400 | Personal private SSH key |
~/.ssh/id_ed25519.pub | 644 | Public key is not a secret |
~/.ssh/config | 600 | Owner-controlled client configuration |
~/.ssh/authorized_keys | 600 or often 644 | Must be protected against untrusted modifications; not itself a private key |
.env with secrets | 600 if owner is the reader | May fail if the app runs as a different account |
Why chmod 600 can break a .env file
Suppose .env belongs to a deployment account but the web process runs as www-data. After chmod 600 .env, that service may lose access. Check the runtime identity and ownership first; where appropriate, a controlled group-readable mode such as 640 or a dedicated secrets store can be a better design.
stat -c '%a %U %G %n' .env
id
ps -eo user,group,comm
For a systemd service, inspect the actual unit with systemctl show and the -p User -p Group options, then confirm that user can reach every parent directory. A file mode also cannot protect secrets copied into Git history, backups, images or logs. Never put a real .env file in a public screenshot.
chmod 600 vs 400, 640, 644 and 700
| Mode | Permissions | When it fits |
|---|---|---|
400 | r-------- | Owner-read-only private key |
600 | rw------- | Owner-only private file |
640 | rw-r----- | File readable by a controlled service group |
644 | rw-r--r-- | Non-secret readable files, public keys |
700 | rwx------ | Private directory that owner must enter |
755 | rwxr-xr-x | Directory others are allowed to traverse/read |
Most important distinction: mode 600 is generally for files; mode 700 is generally for private directories. The extra x bit means execute on a regular file but search/traverse on a directory.
Why chmod 600 makes a directory unusable
Test the difference on a disposable directory as a normal user, without sudo:
mkdir -p ~/sshflow-chmod-lab/private-dir
chmod 600 ~/sshflow-chmod-lab/private-dir
ls -ld ~/sshflow-chmod-lab/private-dir
(cd ~/sshflow-chmod-lab/private-dir)
chmod 700 ~/sshflow-chmod-lab/private-dir
ls -ld ~/sshflow-chmod-lab/private-dir
(cd ~/sshflow-chmod-lab/private-dir && pwd)
With mode 600, an ordinary owner typically cannot enter the directory because its execute/search bit is missing. After restoring 700, the owner can traverse it again. A root shell or elevated capability may bypass ordinary permission checks, making it a poor environment for this demonstration.

600 and 700, including the actual cd result for a non-root user.Never run chmod -R 600 /path/to/project indiscriminately: it can remove traversal rights from every subdirectory and execution rights from scripts. Even applying 600 to files only can break applications that expect to read their assets.
Windows equivalent of chmod 600: PowerShell and NTFS ACLs
There is no single native Windows permission number equivalent to Unix 600. Windows uses NTFS access-control lists (ACLs). For a personal SSH private key used by Windows OpenSSH, the practical goal is to restrict file access to the intended account and appropriate trusted system/security principals.
Inspect the key you intend to use from PowerShell; the following commands are read-only:
$key = Join-Path $env:USERPROFILE '.ssh\id_ed25519'
Test-Path $key
icacls $key
Get-Acl $key | Select-Object Owner, AccessToString
The commands above inspect your existing key but do not change its permissions. For an ACL demonstration, create and use a separate disposable key. To edit permissions, right-click the file → Properties → Security → Advanced; inspect its owner, inherited entries and grants to other accounts. Save or record the original rules before making changes. Do not blindly remove SYSTEM, Administrators or domain principals: the correct ACL depends on who must use the file.
The Microsoft icacls reference documents how to inspect and modify ACLs. Their OpenSSH key management guide explains SSH key handling on Windows. Specific ACL requirements differ for personal client keys, server host keys and server-side authorized_keys files.

Does chmod 600 in Git Bash work?
It may affect the permission bits reported by the Unix-like environment, but do not assume it has restricted NTFS ACLs for native Windows OpenSSH. Confirm the key file's ACL with icacls. The long-running Windows chmod 600 question illustrates why this distinction causes confusion.
What about WSL and /mnt/c?
Inside WSL's Linux filesystem, chmod 600 ~/.ssh/id_ed25519 behaves like a Linux file-mode operation. Windows files mounted at /mnt/c are handled differently. According to Microsoft, the resulting mode bits and the effect of chmod depend on DrvFs metadata and the underlying Windows permissions. For fewer surprises, keep WSL-specific SSH keys in your WSL home directory and protect the corresponding Windows account too.
# Inside WSL: inspect an existing key on its Linux filesystem
ls -l ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
stat -c '%a %n' ~/.ssh/id_ed25519
# Inspect the Windows drive mount options
findmnt -T /mnt/c -o TARGET,FSTYPE,OPTIONS
The WSL example assumes the named key already exists in the Linux home directory; do not generate or copy a production key just to try it. The mount inspection reports how /mnt/c is configured—it does not prove that any Windows key is private. Inspect its Windows ACL separately with icacls. See Microsoft: File Permissions for WSL for DrvFs metadata behavior.
Troubleshooting: chmod says “Operation not permitted” or SSH still fails
| Symptom | Likely cause | First check |
|---|---|---|
chmod: Operation not permitted | Not the owner, restricted filesystem or file attribute | stat, id, mount info |
Permission denied reading .env | Service runs as another user or cannot traverse parent directory | Service user, namei -l |
| SSH reports an unprotected private key | Private-key file readable by group/others or equivalent access | Mode/ACL of the local private key |
| Mode is 600 but SSH login still fails | Wrong key, missing authorization, bad ownership, server policy or another cause | ssh -v, server-side logs |
| Mode looks correct but access differs | ACL, mount policy, SELinux/AppArmor or different runtime account | getfacl, identity, logs |
id
stat -c '%a %U %G %n' /path/to/file
namei -l /path/to/file
getfacl /path/to/file # If installed
Start with read-only checks. sudo chmod may be appropriate for a root-owned file, but it does not change the owner or solve a mismatched application user. Also, a file with mode 600 can remain inaccessible if a parent directory denies traversal.
Does chmod 600 make a file secure?
It reduces ordinary local file access. It does not defeat root, malware already running as the owner, compromised backups, accidental Git commits or a key copied before permissions were fixed. It also does not stop directory-entry removal by a user who can write to the parent directory. Apply least privilege, secure backups, encryption where needed, and credential rotation when exposure is suspected.
Frequently asked questions
What is chmod 600 in symbolic form?
rw------- for a regular file's permission bits. The equivalent symbolic command is chmod u=rw,go= filename.
Is chmod 600 the same as 0600?
Yes for the ordinary owner/group/other file permission bits. The leading zero is common in octal notation.
Can an SSH private key use 400 instead?
Often yes. 400 allows owner read only; 600 allows owner read and write. Group and others have no ordinary permission bits in either case.
Should authorized_keys be 600?
600 is a common safe setting. The file contains public keys, so 644 may also be acceptable when ownership, directory permissions and SSH server rules permit it. A writable-by-others authorization file is a bigger concern.
Can I run chmod 600 recursively?
The command exists, but doing so indiscriminately will remove directory traversal permissions and may break executables. Identify which specific regular files require owner-only access instead.
How do I set chmod 600 on Windows?
Inspect and restrict the private key's NTFS ACL via the Security tab or icacls. A Unix permission number cannot be translated to one universal Windows ACL without considering the account and environment.
SSH key and config-file permission reference
For a typical Linux or macOS SSH setup, use chmod 600 for a private key such as id_rsa or id_ed25519 , and chmod 700 ~/.ssh for the SSH directory. Use chmod 600 for authorized_keys and ~/.ssh/config as safe defaults. If a private key is group- or other-readable, OpenSSH may reject it with a “bad permissions” or “too open” warning.
SSH key permissions: correct chmod values
Use this quick reference for common files under ~/.ssh. The modes shown are safe defaults; some files have more flexible enforcement rules, explained below.
| File / directory | Permission | Status |
|---|---|---|
~/.ssh | 700 | Safe default; server-side StrictModes rejects paths writable by group or other |
Private key (id_ed25519, id_rsa, .pem) | 600 or 400 | Must not be readable by group or other; the client rejects an exposed private key |
Public key (id_ed25519.pub) | 644 | Convention — not checked by OpenSSH |
authorized_keys | 600 | Safe default; with StrictModes, group/other write access is the concern |
known_hosts | 644 | Convention — not checked by OpenSSH |
~/.ssh/config | 600 | Safe default; must not be group- or world-writable |
Home directory (~) | not group/other-writable | Checked by server when StrictModes is enabled |
SSH key ownership: when chmod is not enough
Permissions and ownership are checked together, and ownership problems are easy to create without noticing. The most common cause: running sudo ssh-keygen, which generates a key owned by root in your own home directory. chmod as your normal user won't fix that — you don't own the file, so you can't change its mode at all. Fix the owner first:
sudo chown "$USER":"$USER" ~/.ssh/id_ed25519 ~/.ssh/id_ed25519.pubThe same trap shows up after restoring a backup, copying .ssh from another machine, or pulling files out of a Docker volume — the bytes are fine, but the owner and mode came along from wherever the file used to live.
For directory trees that need ownership corrected recursively, use chown -R carefully and verify the paths before applying it.
Windows SSH key permissions: use ACLs, not chmod
Windows' built-in OpenSSH client enforces the same principle as Linux and macOS — a private key must not be readable by anyone but you — but Windows has no Unix-style permission bits to check. Instead it inspects the file's NTFS Access Control List (ACL), and chmod has no effect there at all.
Keys and config normally live under %USERPROFILE%\.ssh\. A key with a broad ACL (for example, one that still grants access to Everyone or Authenticated Users, which happens by default if the file was created somewhere else and moved in) produces the same warning as on Linux:
Permissions for 'C:\Users\you\.ssh\id_ed25519' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.What Win32 OpenSSH actually requires is that the key is owned by you and not accessible to other users — check the current ACL first, then fix it in PowerShell:
icacls $HOME\.ssh\id_ed25519Look for principals beyond your own account and NT AUTHORITY\SYSTEM / BUILTIN\Administrators — commonly Everyone, Authenticated Users, or BUILTIN\Users, which end up on a key by default if it was created outside your .ssh folder and moved in. Strip inheritance, remove those groups explicitly, then grant your account:
icacls $HOME\.ssh\id_ed25519 /inheritance:r
icacls $HOME\.ssh\id_ed25519 /remove:g "Everyone" "Authenticated Users" "BUILTIN\Users"
icacls $HOME\.ssh\id_ed25519 /grant:r "$env:USERNAME:F"/inheritance:r only stops the file from inheriting permissions going forward — it doesn't remove explicit permissions already granted to other accounts, which is why the /remove:g step matters and shouldn't be skipped. /grant:r then resets your own account's access, replacing any prior grant to you specifically, without touching other principals you haven't removed. Run icacls again afterward and confirm only your account (plus SYSTEM/Administrators, if the SSH service needs it) is listed. A personal key under your own profile usually doesn't need SYSTEM or Administrators at all.
The same fix applies to a downloaded AWS EC2 .pem file, which almost always lands in Downloads with an inherited ACL that's too open:
icacls "$HOME\Downloads\my-key.pem" /inheritance:r
icacls "$HOME\Downloads\my-key.pem" /remove:g "Everyone" "Authenticated Users" "BUILTIN\Users"
icacls "$HOME\Downloads\my-key.pem" /grant:r "$env:USERNAME:F"If you're seeing Bad owner or permissions on ~/.ssh/config from inside VS Code's Remote-SSH extension rather than a plain terminal, it's the same underlying check — apply the same three steps to the config file (and the .ssh folder itself, if the error names the directory instead of a specific file).
Don't add broader groups back just to make the warning disappear — a private key that Everyone or Users can read defeats the point of having one, on Windows exactly as much as on Linux.
For using SSH in a Windows terminal, see the PowerShell SSH guide.
Sources and test methodology
The procedures use a disposable text file, a newly generated Ed25519 key and a temporary directory to demonstrate file-mode changes without risking production credentials. The Windows section uses read-only NTFS ACL inspection. Screenshots are provided to make each check easier to follow; the exact terminal output, warnings and Windows ACL entries vary by operating system, OpenSSH version and local configuration. The ssh-keygen -y check does not establish that remote SSH login succeeded.
- GNU Coreutils — chmod: Change access permissions
- Linux manual — chmod(1)
- OpenSSH — ssh(1) private-key documentation
- OpenSSH — ssh-keygen(1)
- Microsoft — icacls
- Microsoft — OpenSSH key management for Windows
- Microsoft — WSL file permissions
- Akamai / Linode — Modify file permissions with chmod
- Stack Overflow — Windows chmod 600 discussion
Bottom line: Use chmod 600 file when only the file owner should have ordinary read/write access. Verify with ls -l or stat, prefer 700 for private directories, and check actual NTFS ACLs—not Unix mode emulation—when working with Windows OpenSSH.