Chmod 700 – Linux Permission Guide
What It Means, Explanation, How to Use, When to Use & More
chmod 700
Private Owner-Only Permissions
chmod 700 [name]
Copy
chmod -R 700 [directory]
Copy
ls -l [name]
Copy
What Does Chmod 700 Mean?
In Linux, 700 is an octal representation of file system permissions. It grants total control to the Owner while completely locking out the Group and Others.
User (7)
Read + Write + Execute
The owner has full permissions to view, edit, and enter/run.
Group (0)
No Access
Users in the file's assigned group cannot see or touch the content.
Others (0)
No Access
Every other user on the system is denied access entirely.
Why "700"? How the Numbers Work
Every digit in a chmod code is the sum of three values. Once you know the math, you can decode any permission at a glance.
Add them together to build any permission digit:
So 700 reads as: 7 for owner (everything), 0 for group (nothing), 0 for others (nothing).
Permission Matrix (rwx------)
| Level | Read (r) | Write (w) | Execute (x) |
|---|---|---|---|
| Owner | ✔ | ✔ | ✔ |
| Group | ✘ | ✘ | ✘ |
| Others | ✘ | ✘ | ✘ |
Numeric vs Symbolic Notation
chmod accepts two equivalent styles. All four commands below produce identical results:
Letters used in symbolic mode: u = user (owner), g = group, o = others, a = all. Operators: + adds a permission, - removes it, = sets it exactly.
How to Verify It Worked
After running chmod, use ls -l to check the result. The first column shows the permissions:
If you prefer the numeric form, stat -c "%a %n" filename prints the permission as an octal number — you should see 700 confirmed.
When to Use chmod 700 (Real Examples)
Securing your SSH directory Most common
SSH refuses to use your key files if other users can read them. This is the #1 reason people run chmod 700. The full recipe:
SSH enforces this via the StrictModes setting in sshd_config, which is on by default. If your permissions are too open, you'll see "Permissions are too open" or "Permission denied (publickey)".
Private scripts you run yourself
A script that contains API keys, internal hostnames, or logic you don't want other users on a shared machine to inspect or run:
Sensitive config directories
Folders holding credentials, tokens, or backups where no other user has any business reading the contents:
Note: for the files inside these folders, 600 is usually more appropriate since they rarely need to be executable.
chmod 700 vs Other Common Permissions
Before committing to 700, check whether a neighbor might fit better:
| Code | Symbolic | Typical Use |
|---|---|---|
600 |
-rw------- |
Private files that never need to execute — SSH private keys, .env, config files |
700 |
-rwx------drwx------ |
Private scripts you run yourself, private directories you need to cd into (~/.ssh, ~/.gnupg) |
750 |
-rwxr-x--- |
Scripts or folders you want to share with your group (teammates) but hide from everyone else |
755 |
-rwxr-xr-x |
Default for most directories and executable scripts — everyone can read and traverse, only owner can modify |
644 |
-rw-r--r-- |
Default for regular files — owner can edit, everyone else can read (web content, docs) |
777 |
-rwxrwxrwx |
Avoid. Everyone can read, write, and execute. Almost always a security mistake, rarely the real fix for a permissions problem |
The -R Trap (Read This Before Running Recursively)
Running chmod -R 700 on a folder applies 700 to every file inside, which means every file becomes executable. That's usually not what you want. Regular text files, images, config files, and data files have no business being executable — it's a subtle security smell and can break tools that check permissions (web servers, CI pipelines, SELinux).
chmod -R 700 /var/www/mysite will mark every HTML, CSS, JPG, and PHP file as executable and make the whole tree owner-only — which also blocks the web server user from reading it. Sites go down this way.
The correct recursive pattern sets directories to 700 and files to 600 separately:
This gives you a private tree where directories are traversable and files are readable/writable — without marking every file as executable.
Don't Forget Ownership
chmod 700 only protects the file from the perspective of the owner. If the wrong user owns the file, you've locked everyone else out but given full control to someone who shouldn't have it.
Fix it with chown:
Always check ownership (the 3rd and 4th columns of ls -l) before setting permissions. Wrong owner + right permissions = still broken.
Troubleshooting
Only the file's owner (or root) can change its permissions. Either use sudo chmod 700 filename if the change is legitimate, or check ownership with ls -l to confirm whether you should be touching it at all.
Confirm the file exists with ls and that you're in the right folder with pwd. Remember ~/ expands to your home directory, which isn't always where you ran the command from.
FAT32, exFAT, and NTFS drives (common on USB sticks, SD cards, and mounted Windows partitions under WSL) ignore chmod. Move the file to an ext4/APFS/Btrfs filesystem, or adjust mount options like umask/fmask/dmask in /etc/fstab.
~/.ssh directory or key file is readable by others.
Run chmod 700 ~/.ssh and chmod 600 ~/.ssh/id_rsa. Also check your home directory — if /home/you is group- or world-writable, SSH will also reject keys (chmod 755 ~ or stricter).
For a folder you own: chmod 755 foldername (or chmod 700 if it should stay private). For a file: chmod 644 filename. If root owns it, you'll need sudo.
Reset to Sensible Defaults
If you ran chmod 700 somewhere you shouldn't have (or inherited a broken permission set), these are the safe defaults most systems expect:
| Target | Reset Command | Result |
|---|---|---|
| Regular file | chmod 644 filename |
Owner read/write, everyone else read |
| Directory | chmod 755 dirname |
Owner full, everyone else read/traverse |
| Executable script | chmod 755 script.sh |
Owner full, everyone else read/execute |
| Entire website tree | find . -type d -exec chmod 755 {} \;find . -type f -exec chmod 644 {} \; |
Directories 755, files 644 |
Frequently Asked Questions
Use 700 for directories and scripts — the execute bit (the 1 in 4+2+1) is required to cd into a directory or to run a script. Use 600 for plain files that don't need to execute, like config files, private keys, and .env files. Giving a data file the execute bit isn't harmful, but it's messy and some security tools will flag it.
It's one of the most restrictive standard settings, so yes — it's safer than defaults like 755 in the sense that fewer users have access. It's the required permission for ~/.ssh and is commonly used for private backup and script folders. Just remember: "safe" depends on who owns the file. 700 on a file owned by the wrong account protects the wrong person.
Yes. The root (superuser) bypasses all standard permission checks. 700 only restricts regular users and groups. If you need protection from root, you need encryption (LUKS, GPG, age), not chmod.
chmod -R 700 affect existing files?
Yes. The -R flag stands for Recursive — it applies to the target folder, every sub-folder, and every file inside. This also makes every file executable, which is usually not what you want. See "The -R Trap" section above for the safer find-based approach.
They're identical for everyday use. The leading 0 makes it a 4-digit mode where the first digit controls special bits — setuid (4), setgid (2), and sticky (1). 0700 explicitly says "no special bits, plus 700." You'd write 4700 to set setuid along with 700, but that's rare and you should know why you're doing it before you do.
Only if you don't own the file. You can chmod your own files freely. For files owned by root or another user, you'll need sudo chmod 700 filename — and you should pause to make sure that's actually the right move.
Set your umask to 077. umask is a "mask" that subtracts from the default creation permissions: with umask 077, new files are created 600 and new directories 700. Add umask 077 to your ~/.bashrc or ~/.zshrc to make it permanent for your user.
On macOS: yes, chmod behaves exactly like Linux on APFS/HFS+ volumes. On WSL: chmod works on the WSL filesystem but is ignored or behaves oddly on mounted Windows drives (/mnt/c/, etc.) because NTFS doesn't natively carry Unix permission bits. Keep files that need real permissions inside the WSL filesystem (~/), not on the Windows side.
–