Linux [Electronic resources]

Janet Valade

نسخه متنی -صفحه : 357/ 277
نمايش فراداده

chmod (change permissions)

Changes the permissions of one or more files. Can specify permissions using codes or numbers.

Codes: u (owner),g (group),o (other),a (all);+ (add to current permissions),- (subtract from current permissions),= (replace current permissions);r (read),w (write), x (execute).

Numbers: 1= execute, 2 = write,4 = read

Format: chmod

modep filenames Examples: chmod a+x file7 chmod 754 file8 file9

Example 1 : Gives owner, group, and everyone execute permission on file7. See Chapter 9.

Example 2 : Gives read, write, and execute permission to user; gives read and execute permission to group; gives read permission to everyone. The mode is determined by adding the permission numbers for each category separately; e.g., 1(execute)+2(write)+4(read)=7.

Only the owner of the file or the super user can change the group.

Opt

What It Does

Example

-c

Display info about file changes

chgrp -c janet file2 changed group of 'file2' to janet

-R

Make changes in all subdirectories

ls -R janet file3 changes file3 in any subdirectories, as well