Linux Basics

36 / 87
Permissions - Using chmod To Change

You can change the permissions of a file using chmod command: chmod permission_cmd myfile

You can allow or disallow the user (u), group (g) or other(o) the following actions: read (r), write (w) and execute (x).

So, if you want to allow the user (the person who owns it) to execute the file:

chmod u+x myfile

And to disallow the user (the person who owns it) to execute the file:

chmod u-x myfile

Say you want to give the rw permissions to owner and group of a file, you will have to use the following command:

chmod u+r,u+w,g+r,g+w myfile

    or

chmod u+rw,g+rw myfile

To give members of a group ability to modify a file, use:

chmod g+w myfile