Lesson 4.2: File and directory permissions
Reading -rwxr-x---: owner, group and others, read/write/execute and what they mean for directories; changing them with chmod in symbolic (u+x) and numeric (640) form, ownership with chown and chgrp, and default permissions with umask.
19 min
You will learn to
- Read the ten characters of a permission string
- Explain r, w and x for files and for directories
- Use chmod in symbolic and numeric form
- Change owner and group with chown and chgrp
- Explain umask and default permissions
Key terms
- Owner, group, others
- The three classes every permission is set for: the file's owner (u), members of the file's group (g), and everyone else (o).
- r, w, x on a file
- r read the contents, w change the contents, x run it as a program.
- r, w, x on a directory
- r list the names inside, w create, rename and delete entries inside, x enter it (cd) and reach the files in it.
- Permission string
- The 10 characters at the start of ls -l: the type (- file, d directory, l link), then rwx for owner, group and others.
- Octal (numeric) mode
- Each class as one digit: r=4, w=2, x=1, added up. 755 = rwxr-xr-x, 644 = rw-r--r--, 600 = rw-------.
- chmod / chown / chgrp
- chmod changes permissions (owner or root); chown changes owner and group (root only); chgrp changes the group (owner, to a group they belong to).
- umask
- A mask of permissions removed from every new file and directory you create.
← Working with users and groups · All lessons · Changing users: su and sudo →