3.30. Changing a File's Permissions: chmodNow that the file's group was changed, it was necessary to update its permissions, or mode, to deny all access rights to general users. To do this, I used the chmod utility (Figure 3-40).
To remove read permission from others, I used chmod as follows: $ ls -l heart.final ...before. -rw-r--r-- 1 glass music 213 Jan 31 00:12 heart.final $ chmod o-r heart.final ...remove read for others. Figure 3-41 gives some other examples of chmod.
I recommend that you protect your login directory from unauthorized access by not granting write permission for anyone but yourself, and by restricting read and execute permission to yourself and members of your group. Here's an example of how to do this: $ cd ...change to home directory. $ ls -lGd . ...list attributes of home dir. drwxr-xr-x 45 glass 4096 Apr 29 14:35 . $ chmod o-rx ...update permissions. $ ls -lGd ...confirm. drwxr-x--- 45 glass 4096 Apr 29 14:35 . $ _ Note that I used the -d option of ls to ensure that the attributes of my home directory were displayed, rather than the attributes of its files. The chmod utility allows you to specify the new permission setting of a file as an octal number. Each octal digit represents a permission triplet. For example, if you wanted a file to have the following permission settings: rwxr-x-- then the octal permission setting would be 750, calculated in Figure 3-42.
The octal permission setting would be supplied to chmod as follows: $ chmod 750 . ...update permissions. $ ls -ldG ...confirm. drwxr-x--- 45 glass 4096 Apr 29 14:35 . $ _ |