Terminal Icon

Setting UNIX permissions

To change permissions for an item, use the chmod command. The syntax of the command is as follows:

chmod securitygroup [changetype] [permission] [file or directory]
  • u - user

  • g - group

  • o - other

  • all - all

The options for each item in the command are as follows.

securitygroup (The person or group whose permission you are changing)

changetype (For adding or subtracting a permission)

  • “+” add permission

  • “-” subtract permission

permission (The permission you are changing)

  • r - read

  • w - write

  • x - execute

file or directory (The name of the file or directory to change)

Here are some chmod examples:

To remove write access for group and others for the file myfile, enter:

chmod go-w myfile 

To add read and write access for group and others for the files myfile1 and myfile2, enter:

chmod go+rw myfile1 myfile2 

To add read, write, and execute access for everyone for myfile1 enter:

chmod ugo+rwx myfile1 

For more information on changing UNIX permissions, see the chmod man page by entering “man chmod” in the Terminal window.


Related Topics

UNIX

Open

man page for chmod