chmod calculator

chmod 400

chmod 400 gives the owner read permission and denies write, execute, group, and other-user access. It is useful for private keys and sensitive files that should be read but not changed during normal use.

Permission breakdown

400 = r--------

Owner4r--
Group0---
Other0---

Try it yourself

Explore chmod 400

The calculator starts at 400. Add owner write permission to compare 600, or inspect exactly which classes remain unable to read the file.

Live conversion

Enter a permission mode

Use three digits, each from 0 to 7.

Permission bits

Choose permissions

Owner

The file or directory owner

Group

Members of its assigned group

Other

All other users

What chmod 400 grants

The first digit is 4, granting read permission to the owner. The group and other-user digits are 0, and no write or execute bits are present. A regular file appears as -r--------. Its owner can open the file, while ordinary processes cannot modify or execute it and other local users receive no access.

Mode 400 is a guard against routine writes, not an immutable lock. The file owner can change the mode again, and privileged accounts may still alter the file. Use it to express that normal operation is read-only; use filesystem immutability, protected deployment controls, or a secret manager when stronger change protection is required.

Read-only keys and credentials

Authentication clients generally need to read a private key but do not need to rewrite it. Removing owner write permission reduces the chance that a script, editor, or mistaken redirect overwrites the only local copy. The same pattern can fit exported credentials or signed material that an application consumes without updating.

A read-only mode does not replace backups or key rotation. Before restricting the working copy, store recovery material according to the provider guidance and verify that the application truly reads rather than updates the file. A program that legitimately rewrites a credential needs an owner-writable mode or a separate managed storage workflow.

Why AWS tutorials use chmod 400 for PEM files

An EC2 key-pair download is used as an SSH private key. The SSH client needs to read it, but editing the downloaded key is not part of connecting to an instance. Mode 400 therefore supplies the required read access while denying both local disclosure to other users and unnecessary owner writes.

If the SSH client reports an unprotected private key or ignores the PEM file, the problem is a task-specific connection error rather than a request for a permission definition. Use the AWS PEM permissions fix for macOS, Linux, Windows, WSL, username, key-pair, and security-group checks.

400 compared with 600

chmod 600 adds owner write permission while keeping group and other users blocked. Choose 600 for a private file that its owner must edit, such as an actively maintained credential file. Choose 400 for a consumed key or secret that should remain read-only during ordinary use.

Both modes depend on correct ownership. If the wrong account owns a 400 file, the intended process cannot read it, and broadening the group or other digits is rarely the right repair. Confirm the owner and the account running the command before granting additional access.

Command example

Apply chmod 400

Apply 400 to a private key that only its owner needs to read and that no routine process should modify.

chmod 400 my-key.pem

Linux permission guides

Common permissions