Skip to content
Commitpedia
Log in Join & edit

File permissions: chmod, chown and what 755 means

Every file has an owner, a group and read/write/execute permissions for three kinds of users. chmod changes the permissions and chown changes the owner.

Not checked by a trusted editor yet Last edited Outdated?

Edit history of File permissions: chmod, chown and what 755 means: 1 recorded edit
Edit history · 1 edit
Type
Article
Edits
1
Editors
1
First issued
15 Oct 2026
Last edit
15 Oct 2026
Reading
2 min

Linux and macOS decide who may read, change or run a file using a simple permission system. Once you can read it, messages like Permission denied become easy to fix.

Reading ls -l

$ ls -l
-rwxr-xr-x  1 ana  staff  1204 Oct  3 09:12 deploy.sh
-rw-r--r--  1 ana  staff   310 Oct  3 09:10 notes.txt
drwxr-x---  4 ana  staff   128 Oct  3 09:00 private

The first character is the type: - for a regular file, d for a directory, l for a symbolic link. The next nine characters are three groups of three:

  1. user (the owner, here ana)
  2. group (members of the group, here staff)
  3. others (everyone else)

Each group shows r (read), w (write) and x (execute), or - if that permission is missing. So rwxr-xr-x means the owner can do everything, and the group and others can read and run but not change the file.

What r, w and x mean for folders

On a directory, r lets you list its contents, w lets you create, rename and delete files inside it, and x lets you enter it with cd and reach the files inside. A folder with r but no x is surprisingly useless, so directories almost always have both.

The numbers: 755, 644, 600

Each permission has a value: read = 4, write = 2, execute = 1. Add them up for each of the three groups and you get a three-digit number.

  • 7 = 4+2+1 = rwx
  • 6 = 4+2 = rw-
  • 5 = 4+1 = r-x
  • 4 = r--
  • 0 = ---

So 755 is rwxr-xr-x: typical for scripts, programs and directories. 644 is rw-r--r--: typical for ordinary files. 600 is rw-------: private files such as SSH keys. 700 is a private directory, such as ~/.ssh.

Changing permissions with chmod

chmod 755 deploy.sh        # numeric form
chmod +x deploy.sh          # add execute for everyone
chmod u+x,go-w deploy.sh    # owner gets x, group/others lose w
chmod u=rw,go=r notes.txt   # set exactly: same as 644
chmod -R go-rwx private/    # recursively remove group/other access

The letters are u (user), g (group), o (others) and a (all). The symbolic form is handy when you want to change one bit without touching the rest.

Changing the owner with chown

chown sets the owner and optionally the group. Changing a file to a different owner normally requires administrator rights, so you will usually see it with sudo.

Check before you run this

  • Runs with administrator rights. Make sure you understand every line.
sudo chown ana deploy.sh
sudo chown ana:www-data site/        # owner and group
sudo chown -R ana:ana ~/projects     # whole tree

Common pitfalls

  • chmod 777 is not a fix. It lets every user on the machine change the file. Find out which user actually needs access and grant only that.
  • A script needs x to run as ./script.sh. Without it you get Permission denied. Either chmod +x it or run bash script.sh.
  • Recursive chmod hits files and folders alike. chmod -R 644 removes x from directories and locks you out of them. Use find to treat them separately: find dir -type d -exec chmod 755 {} + and find dir -type f -exec chmod 644 {} +.
  • Sticking with sudo to work around permission errors in your own project usually means some files were created as root by mistake. Fix ownership once with chown instead.

See also

  • 0049 Pipes and redirection: connecting commands A pipe sends one command's output into another command, and redirection sends output to a file. Together they let small tools build… Beginner · Concept · Linux, macOS Article Basics · Text processing 15 Oct 2026
  • 0051 Environment variables and PATH Environment variables are named settings that every program inherits from the shell. PATH is the one that tells the shell where to… Beginner · Concept · Linux, macOS Article Basics 15 Oct 2026
  • 0057 Shell cheat sheet: everyday commands A quick reference for moving around, managing files, viewing and searching text, checking processes and disk space in bash and zsh, with… Beginner · Reference · Linux, macOS Article Basics · Command-line tools 15 Oct 2026

History

Every saved edit is kept. The plot on the sleeve draws one line per edit. Open any edit to see exactly what changed.

  1. Commitpedia +3,036 chars

Report a problem

Something wrong, unsafe or copied? Tell the editors.
What is wrong?