CHMOD Command in Unix

Prev     Next

Chmod command in UNIX :

  • This command is used to change the file permissions. Basically, this command defines who can do what operations on the files. By default, when we create the files, it will be created with Read & Write access to User and Read access to both group and others.
  • With this access, the User (Owner) can Read and modify (update) the files and group & Others can only view the files but cannot be modified.

For Ex:

The file “file.txt” has the permission “rw-r–r—”. First 3 fields represents the User (Owner) permission, next 3 fields represents the group permissions and next 3 fields represents Others permission.

So,

  • User has “rw” which means Read and Write access.
  • Group has “r” which means Read access only
  • Others has “r” which means Read only access     
  • By using “chmod” command we can change the file permissions according to our requirments.
  • If I want to execute any of the files, I would need execute “x” permission. Please see the below example on how to provide the execute permission.

Chmod 744 file.txt

Now the above file the execute permission for the User. Likewise, we can change the file permissions according to our needs like, chmod 777 filename or chmod 755 filename etc.



Share this website !!!
Facebook Twitter Linkedin