Permissions and owners
The chmod command
Changes the permissions of a file or folder. The basis of Linux security.
Syntax
chmod <modo> <archivo>Most useful options
755Everything for the owner; read and execute for the rest644The owner reads and writes; the rest only reads+xAdds execute permissionu+w o-rSymbolic mode by groups: u, g, oCopy-ready examples
$ touch run.sh && chmod 755 run.shScript executable by everyone$ touch run.sh && chmod +x run.shThe minimum: make it executable$ touch secreto.txt && chmod 600 secreto.txtOnly the owner can read and write itYou can try them in the browser terminal: it does not touch your computer.
Typical mistakes
- Only the owner of the file (or root) can change its permissions.
FAQ
What does 755 mean?
4+2+1 for the owner, 4+1 for group and others: read and execute.
Why Permission denied when running my script?
It lacks execute permission: chmod +x.
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course