5.M: Review Quiz | 5: Managing Files and Directories | 5.L.1: Looking at File Permissions |
Now that you know what your file permissions are, it's time to modify
them. The "change mode" command chmod
changes the
permissions of files as dictated by the command arguments. There
are a number of ways to state the arguments for the "change mode" command.
One way is to give the command followed by the permission access you would like to change and the name of the file to be affected:
+
sign adds permission.
-
sign removes permission.
u
indicates users.
g
indicates group.
o
indicates others.
a
indicates all of
the above (everybody).
> cd ~/development/prog
> ls -l
-rw-r--r-- 1 melanie users 68 Mar 3 13:18 area.f
We see from listing that melanie has read and write permissions, while
the group and outside world have only read access. To change a file's
permission access, you enter the chmod
command with arguments
giving the party affected, whether you want to add ore remove permission,
and finally the set of users affected. For example, change the file
permission of area.f to allow everybody to execute it, and for the
group to write to it, and check the result:
> chmod a+x,g+w area.f
> ls -l