There are a few ways of setting the permissions on a file or directory. The `chmod` (Change Mode) command will be your friend here. To add write permissions to a file, for example, you can do something like this: ```bash $ chmod +w sample.txt ``` The `+w` means "add write access." If you want to get more granular in how you set permissions on a file or directory, you can prefix the permission with `u`, `g`, `o`, or `a`, which stand for "user (owner)", "group", "other", and "all", respectively: ```bash $ ls -lah test.txt -rwxr--r-- 1 bob staff 1GB Jul 14 15:24 test.txt $ # Remove write access for user $ chmod u-w test.txt $ ls -lah test.txt -r-xr--r-- 1 bob staff 1GB Jul 14 15:24 test.txt $ # Add execute access for group $ chmod g+x test.txt $ ls -lah test.txt -r-xr-xr-- 1 bob staff 1GB Jul 14 15:24 test.txt ``` What if you want to set access level permissions for the user, group, and other all at once? You can do so with 3 numbers, each from 0 to 7. In this octal system, execute, write, and read permissions each add 1, 2, and 4 respectively, resulting in non-ambiguous designations of permissions. The following table shows what access level each number represents: |Number|Permission| |---|---| |0|No permission granted.| |1|Can execute.| |2|Can write.| |3|Can write and execute (2 + 1 = 3).| |4|Can read.| |5|Can read and execute (4 +1 = 5).| |6|Can read and write (4 + 2 = 6).| |7|Can read and write and execute (4 + 2 + 1 = 7).| If you combine the permissions from the table above—one each for owner, group, and other—you can define the whole set of permissions for a file or directory: ```bash $ chmod 777 test.sh $ ls -l test.sh -rwxrwxrwx 1 bob admin 0B Jul 15 15:24 test.sh $ chmod 000 test.sh $ ls -l test.sh ---------- 1 bob admin 0B Jul 15 15:24 test.sh $ chmod 754 test.sh $ ls -l test.sh -rwxr-xr-- 1 bob admin 0B Jul 15 15:24 test.sh ``` **Note:** in order to change the permissions of a file or directory, you must be its owner, be root, or use sudo. See the [Root User and Sudo section below](https://launchschool.com/books/command_line/read/permissions#rootuserandsudo).