chmod 400

chmod 400 gives r--------. Read-only for the owner. Used for private keys and secrets that should never change, such as an AWS .pem file.

  • Free
  • No Sign-Up
  • Runs in Your Browser

Owner

Group

Others

Permissions

r--------

Command

chmod 400 file

Chmod Calculator

chmod 400 explained

Octal400
Symbolicr--------
Ownerread
Groupno access
Othersno access
ls -l Shows-r--------
Commandchmod 400 file
Symbolic Commandchmod u=r,g=,o= file

Each digit of 400 is one class of user and adds up read (4), write (2) and execute (1). 4 for the owner is read; 0 for the group is no access; 0 for the others is no access.

Read-only for the owner. Used for private keys and secrets that should never change, such as an AWS .pem file.

On a directory, execute means permission to enter it and reach files inside; read means permission to list it. That is why directories usually have execute wherever they have read.

Questions

What does chmod 400 mean?
Owner: read. Group: no access. Others: no access. In letters: r--------.
Is chmod 400 safe?
Yes, for the uses described here. Nobody outside the classes given write access can change the file.
How do I apply 400 to every directory but not files?
find /path -type d -exec chmod 400 {} + (and use -type f for files only).
How do I set 400 recursively?
chmod -R 400 /path. Be careful: this gives files and directories the same mode, which is rarely what you want; the find command above is safer.

Run servers for other people?

Frabs stops the abuse their VMs send out, and keeps your network off blocklists.