devkult_
tools29converters34

chmod 700

rwx------Safe when used as intended

Only the owner can read, write and execute.

700 is fully private: the owner can do anything, and no other user — apart from root — can list, enter, read or run anything.

It's required in a few places. OpenSSH's StrictModes checks that ~/.ssh isn't writable by anyone else, and GnuPG warns when ~/.gnupg is accessible to others.

Permission by permission

WhoReadWriteExecuteDigitMeans
owner✓✓✓7read, write and execute
group———0no permissions
others———0no permissions
  • In ls -l: -rwx------ for a file, drwx------ for a directory.
  • Symbolic form: u=rwx,g=,o=
  • New directories get this mode when the umask is 077.

Use it for

  • ~/.ssh and ~/.gnupg directories.
  • Private scripts only you should run.
  • Directories holding secrets, backups or personal data.

Avoid it for

  • Anything a service running as another user must read.
  • Private files that aren't programs: use 600.

Commands

chmod 700 path

set this mode on a file or directory

chmod u=rwx,g=,o= path

the same, written symbolically

find path -type d -exec chmod 700 {} +

apply it to every directory in a tree, leaving the files alone

stat -c '%a %A %n' path

check the current mode on Linux (macOS: stat -f '%Lp %Sp %N' path)

Try variations

700
-rwx------
WhoreadwriteexecuteDigit
owner7
group0
others0

The owner can read, write and execute; the group can do nothing; everyone else can do nothing.

chmod 700 file
chmod u=rwx,g=,o= file

Read the full guide to chmod 700 →

Frequently asked questions

What permissions should ~/.ssh have?

700 for the ~/.ssh directory, 600 for private keys and authorized_keys, and 644 for public keys (.pub). Too-open permissions make sshd ignore authorized_keys or ssh refuse a key.

Related modes