The Access Control Vector
Security on an Ubuntu Linux server is strictly governed by a matrix of file permissions. Every single file and directory dictates exactly who is allowed to read its contents, who is allowed to write or modify it, and who is allowed to execute it as a program. When you download a custom bash script from a developer repository, it is almost always downloaded as a standard text file without execute permissions. The operating system will actively block you from running it until you manually grant it the necessary security clearance.
How to Change File Permissions
The standard tool for modifying this security matrix is the chmod (change mode) command, which relies on a simple alphanumeric syntax.
1. Open your terminal application or connect to your server via SSH.
2. Navigate to the directory containing your target file.
3. To verify the current permissions, type ls -l filename.sh. The output will look something like -rw-r--r--, indicating the file cannot be executed.
4. To rapidly grant executable permissions to the owner of the file, use the +x (plus execute) flag:
chmod +x filename.sh
5. If you need to lock down a sensitive configuration file (such as a database password file) so that only the owner can read it, and no one else can even look at it, use the numerical octal format:
chmod 600 config.php
6. If you want to change the permissions of a folder and every single file contained within it simultaneously, add the -R (recursive) flag:
chmod -R 755 /var/www/html/website/
Changes are applied instantaneously, allowing scripts to execute or immediately blocking unauthorized access to sensitive data.