Thursday, May 22, 2014

Using chmod command


Using chmod on the unix command line

Syntax: chmod mode file
Example: chmod 766 readme.txt

chmod codes

Each digit in the mode parameter represents the permissions for a user or a class of users:

  • the first digit corresponds to the owner of the file
  • the second digit corresponds to the file's group
  • the final digit corresponds to everybody else.


There are eight digits that can be used in the mode parameter.

  • 0 - Deny all
  • 1 - Execute Only
  • 2 - Write Only
  • 3 - Execute + Write
  • 4 - Read Only
  • 5 - Read + Execute
  • 6 - Read + Write
  • 7 - Read + Write + Execute

Examples: You set your directory permissions to 755. This means that the directory owner can read, write, and execute, while group and world can read and execute (use) the directory.
You set your file permissions to 644. This means that the file owner can read and write (edit) the file, while everyone else can only read it.


--
With metta
Quang Phan

No comments:

Post a Comment