Skip to main content
chmod 755 gives the owner read, write and execute permission (7 = 4 + 2 + 1) and gives the group and everyone else read and execute (5 = 4 + 1). In ls -l it shows as rwxr-xr-x. Use 755 for directories and scripts, 644 (rw-r--r--) for normal files, and change the owner with chown, for example sudo chown alex:www-data file.

Before you start

  • Connect with SSH. You can change permissions on your own files; for other files you need sudo (root can leave it out).
  • Take a backup or snapshot before you change permissions recursively on a large folder.

How to read Linux permissions

Run ls -l:
Each letter has a number. Add them up for each of the three positions:

What do chmod 755, 644, 600 and 777 mean?

Don’t ā€œfixā€ a permission error with chmod 777. It lets every user and every process on the server change or replace the file, which is a common way websites get hacked. Find out which user needs access and give only that user or group the rights it needs.

How to change permissions with chmod

1

Set permissions with numbers

2

Or change one part with letters

u = owner, g = group, o = others, a = all. + adds, - removes, = sets exactly.
3

Check the result

Expected output:

How to set different permissions for files and directories

chmod -R 755 makes every file executable, which you rarely want. Use find to treat them separately, for example for a website:

How to change the owner with chown

The web server user is www-data on Ubuntu and Debian, and nginx or apache on AlmaLinux and Rocky Linux, depending on which web server you installed.
Never run chown -R or chmod -R on /, /etc, /usr or /var as a whole. Changing system ownership breaks sudo, SSH and other services, and the only reliable fix is a restore from backup or a reinstall. Double-check the path before pressing Enter.

Special permissions: setgid and sticky bit

What is umask?

umask sets the default permissions for new files. The usual value 0022 makes new files 644 and new directories 755. Check yours with umask.

How to check it worked

Test as the user who needs access, for example the web server user:
If the file prints, the permissions are right. Permission denied means the user is missing r on the file or x on one of the parent directories. namei -l /var/www/example.com/index.html shows the permissions of every directory in the path.

Frequently asked questions

What is the difference between chmod 755 and 644?

755 adds execute (x). Directories need x so you can open them, and scripts need it to run. Plain files such as HTML, images and config files don’t, so they use 644.

What permissions should ~/.ssh have?

~/.ssh must be 700 and ~/.ssh/authorized_keys 600, owned by the user. SSH refuses keys when they are more open. See fix SSH ā€œPermission denied (publickey)ā€.

What does chmod +x do?

It adds execute permission for the owner, group and others (limited by your umask), so you can run the file with ./script.sh.

Why does chmod say ā€œOperation not permittedā€?

Only the owner or root can change a file’s permissions. Use sudo, or check the owner with ls -l.

VPS and dedicated server guides

Every server guide in one place.

Manage users and groups

Put users in shared groups.

Essential Linux commands

The commands you use every day.

Find files and text

Search with find and grep.

Checked against the official GNU Coreutils manual: chmod, chown and file modes on 4 November 2026; commands tested on Ubuntu 24.04 LTS. Commands can differ on other distributions or releases.

Need Extra Help?

If you encounter any issues, our support team is ready to assist:

Save on Your Hosting

Ready to upgrade your hosting? Use code KB20 at checkout for 20% off your first order!

Last Updated: November 2026