| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
chmod - Change File Access Permissions Remembering the access privileges shown by the ls command with the -l option, this command will allow either the user/owner of file or the system administrator (root) to change the permissions mask for a file or directory. File permissions can be specified with two different methods, symbolic mode or numeric (absolute) mode. Only the first mode, symbolic, will be covered here, information about the absolute (numeric) mode can be found in the man and info pages. Definitions are in order: the abbreviation u stands for the files user/owner, g stands for the files group user, and o stand for all other system users. The letters r, w, x represent read, write, and execute permissions and finally + means add a privilege and - means remove a privilege and are summarized as shown in Table 13.
First, the general form and then an example. chmod [options] mode[, mode] filename How this command changes privileges is probably best understood from a couple examples. A long directory listing of the file, example_file, might be: ---xrw-rw- 1 someuser somegrp 54 Apr.1 12:01 example_file Here, the command: chmod u+rw,go-w example_file will add read and write privileges for the file example_files user/owner and remove write privileges for the files group user and all other system users. Notice, first multiple privilege modes can be used simply separating them by a comma. This allows modifying the privilege mask for user, group, other all in one command, when different privileges are needed for each. Secondly, no privileges not referenced in this form are changed. In this example the execute privilege for this file would not have been changed for user, group, or other and the read privileges for group and other would remain whatever they were before this command had been executed. Now, a long listing of this file would yield: -rwxr--r-- 1 someuser somegrp 54 Apr.1 12:01 example_file Then running: chmod u-x example_file would remove the execute privilege for the files user/owner. This could have been accomplished all in the first example. The final access privileges would now look like: -rw-r--r-- 1 someuser somegrp 54 Apr.1 12:01 example_file
Home - Table Of Contents - Contact Us CertiGuide to A+ (A+ 4 Real) (http://www.CertiGuide.com/apfr/) on CertiGuide.com Version 1.0 - Version Date: March 29, 2005 Adapted with permission from a work created by Tcat Houser et al. CertiGuide.com Version © Copyright 2005 Charles M. Kozierok. All Rights Reserved. Not responsible for any loss resulting from the use of this site. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||