next up previous
Next: Changing file ownership Up: Permissions Previous: Displaying file permissions

Changing file permissions

The chmod command is used to change the permissions for a file. Only the owner of a file or the superuser can modify its permissions. The format of the chmod command is
  chmod ugo=rwxs
where

For instance,

  chmod a+x foo.pl
adds execution permission for all three categories of users to file foo.pl.
  chmod o-rwx private
denies all access to directory private to users other than its owner or members of its group.

For convenience, those who know the octal number system can use a numeric code to specify permissions. To define the octal number, each of the three rwx fields corresponds to one digit. If r is present, the digit contains a 4, if w is present, the digit contains a 2, and if x is present the digit contains a 1. These three numbers are summed to produce the octal digit. For instance

  chmod 750 bar
sets the permission of bar to rwxr-x---. (The octal method can also be used to set the set-id permissions. See the chmod man page for details.)


next up previous
Next: Changing file ownership Up: Permissions Previous: Displaying file permissions
Robert Moniot
2000-09-13