This
can be done for the owner user (u), owner group (g), others (o), and all users (a). For example,
start with a file that has all permissions open (rwxrwxrwx). Run the following chmod commands
using minus sign options. The resulting permissions are shown to the right of each command:
chmod a-w file r-xr-xr-x
chmod o-x file rwsrwsrwchmod
go-rwx file rwx------
Likewise, here are some examples, starting with all permissions closed (---------), where the
plus sign is used with chmod to turn permissions on:
chmod u+rw files rw-------
chmod a+x files --x--x--x
chmod ug+rx files r-xr-x---
When you create a file, it??™s given the permission rw-r--r-- by default. A directory is given the
permission rwxr-xr-x. These default values are determined by the value of umask. Type umask
to see what your umask value is. For example:
$ umask
022
The umask value masks the permissions value of 666 for a file and 777 for a directory. The umask
value of 022 results in permission for a directory of 755 (rwxr-xr-x). That same umask results in
a file permission of 644 (rw-r--r--). (Execute permissions are off by default for regular files.)
Time saver: Use the -R options of chmod, to change the permission for all of the files and
directories within a directory structure at once.
Pages:
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232