← Linux & the Command Line tutorial
Permissions
Every file has read/write/execute permissions for its owner, its
group, and everyone else. ls -l shows them as a string like
-rwxr--r--.
Example: making a script executable
$ chmod 755 deploy.sh
$ chown ada:ada deploy.sh
$ ls -l deploy.sh
chmod 755 sets permissions using three digits — owner
(7 = read+write+execute), group (5 = read+execute), everyone else
(5 = read+execute). chown ada:ada changes who owns the file.
Misconfigured permissions are a genuine, common source of real security
vulnerabilities — a config file containing secrets that's readable by
"everyone" when it should only be readable by its owner is a classic,
easily-overlooked mistake, and exactly the kind of thing a security
assessment specifically checks for.
$ chmod 755 deploy.sh
$ chown ada:ada deploy.sh
$ ls -l deploy.sh
-rwxr-xr-x 1 ada ada 128 Aug 10 12:00 deploy.sh