linux chmode

علی ذوالفقار
1399/01/27 13:47:41 (871)
make a file (e.g. a .sh script) executable, so it can be run from a terminal : chmod +x filename.sh
And to set all permissions you can type:
chmod +rwxrwxrwx /path/to/file.extension
Or (this is a bit easier to write, but harder to remember each one):
chmod +777 /path/to/file.extension
Finally, you can do:
chmod -777 /path/to/file.extension
To take all permissions away from everyone.
And:
chmod +300 /path/to/file.extension
To add read and write for user, without affecting any other permissions (e.g. Execute permissions).
  • 755 - Owner has all, and Group and Other can read and execute
  • 700 - Owner has all
  • 644 - Owner can read and write, and Group and Other can read
  • 600 - Owner can read and write
    • And, if you're using non-trivial user groups:
  • 775 - Owner can read and write, and Group and Other can read
  • 770 - Owner and Group have all, and Other can read and execute
  • 750 - Owner has all, and Group can read and execute
  • 664 - Owner and Group can read and write, and Other can just read
  • 660 - Owner and Group can read and write
  • 640 - Owner can read and write, and Group can read
    • 777 and 666 are rarely used, except in /tmp.
run file : ./filename.sh
Back