Permissions and Users
Harry
· 14 Sep 2026
· 1 views
Advertisement
Reading permissions
ls -l shows a permission string like -rwxr-xr--. After the first character (file type), it is three groups of three:
- owner (rwx) – the user who owns the file.
- group (r-x) – members of the file's group.
- others (r--) – everyone else.
Each group has read (r), write (w) and execute (x) bits. Execute on a directory means you may enter it.
chmod: change permissions
You can set permissions symbolically or numerically. The numeric form treats rwx as bits: r=4, w=2, x=1, added per group:
chmod +x script.sh # make executable
chmod u+w,o-r file # symbolic: add owner-write, remove others-read
chmod 755 script.sh # rwx for owner, r-x for group and others
chmod 644 file.txt # rw for owner, r for the rest
755 and 644 are the two you will use most – for programs/directories and for regular files respectively.
chown: change ownership
sudo chown ada file.txt # change owner
sudo chown ada:devs file.txt # change owner and group
sudo chown -R ada:devs project/ # recursively
root and sudo
The root user can do anything. You normally log in as a regular user and run individual privileged commands with sudo (“superuser do”), which is safer than staying root all the time. Installing software, editing system files and changing others' files all need sudo.
Key points
- Permissions apply to owner, group and others as read/write/execute.
chmodsets permissions (symbolic or numeric like 755, 644).chownchanges a file's owner and group.- Run privileged commands with
sudorather than logging in as root.