After you have determined what permissions are in effect, you can change them by calling the chmod command in the following format:
chmod who+permission file(s)or
chmod who-permission file(s)The following list defines each component of this command line.
|chmod||name of the program|
one of three user groups:
|+ or -||instruction that grants (+) or denies (-) permission|
any combination of three authorizations:
|file(s)||file (or directory) name(s) listed; assumed to be branches from your current directory, unless you use full pathnames|
The following examples show a few possible ways to use the chmod command. As the owner of display, you can read, write, and run this executable file. You can protect the file against being accidentally changed by denying yourself write (w) permission. To do this, type the command line:
chmod u-w displayAfter receiving the prompt, type ls -l and press the <Return> key to verify that this permission has been changed, as shown in the following screen.
As you can see, you no longer have permission to write changes into the file. You will not be able to change this file until you restore write permission for yourself.
Now consider another example. Notice that permission to write into the file display has been denied to members of your group and other system users. However, they do have read permission. This means they can copy the file into their own directories and then make changes to it. To prevent all system users from copying this file, you can deny them read permission by typing:
chmod go-r displayThe g and o stand for group members and all other system users, respectively, and the -r denies them permission to read or copy the file. Check the results with the ls -l command.
For more information, refer to ls(1) and chmod(1).