each file has 3 separate permissions:

  • user - the user who chowns this file has these permissions on this file
  • group - the group who chowns this file has these permissions on this file
  • other - the general public within the system has these permissions on this file

FORMAT

chmod [ugoa…][[+-=][rwxXstugo…]…][,…]

  • u stands for user
  • g stands for group
  • o stands for others
  • a stands for all (i.e. user, group, and other)

Examples
chmod a+x file # gives file execute permissions to user group and others
chmod +x file # gives file execute permissions to user group and others

More

  • ls -l : view permissions of file and directories in current directory
  • sudo chmod 777 file : change permissions for a file
  • sudo chmod 777 directory -R : change permissions for a directory and everything inside it

chmod permissions format
USER|GROUP|OTHERS

Each number is a binary format of
READ|WRITE|EXECUTE

They can either be 1 or 0