How to change file permissions on linux?


by jewel , in category: General Help , a month ago

How to change file permissions on linux?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer


by johann , a month ago


To change file permissions on Linux, you can use the chmod command. The chmod command allows you to modify the read, write, and execute permissions for the owner, group, and others.

Here is the basic syntax for the chmod command:

chmod options permissions filename


  • -v: Verbose mode, displays a message for each file processed.
  • -c: Like verbose mode, but displays a message only if a change is made.
  • -R: Recursively change permissions for directories and their contents.


  • u: User/owner permissions.
  • g: Group permissions.
  • o: Other (everyone else) permissions.
  • a: All permissions.

Permissions can be specified using two different methods:

  1. Symbolic method: + adds permissions. - removes permissions. = sets permissions explicitly. r for read permission. w for write permission. x for execute permission.
  2. Numeric method: Each permission has a numeric value. 4 for read permission. 2 for write permission. 1 for execute permission.


  1. To give read, write, and execute permissions to the owner of a file: chmod u+rwx filename
  2. To remove read and write permissions from the group and others: chmod go-rw filename
  3. To give read and execute permissions to all users: chmod a+rx filename
  4. To recursively change permissions for all files and directories in a directory: chmod -R u+rwx directory

Note: You will need appropriate permissions or superuser (root) privileges to change permissions on files/directories you don't own. Be careful while altering permissions for system files.