6.6 Changing permissions
Permissions can be changed with the chmod command.
To add or remove a permission, use + or -, followed by the permission we would like to change (r, w or x).
For example, let’s add the executing permission to all owners:
… and remove it again:
To change permissions of only one owner, add the owner in front (u for user, g for group, o for other).
For example, let’s remove read permission from other:
and remove write permissions from group:
Back to our original problem: How can we run test.sh? To run a script, the user (me) needs to have executing rights. Currently, we do not have this, but we can easily add it with:
Now, let’s run the script!