Understand Linux file permissions
Read permission bits and understand what 644, 755 and 700 mean before changing a file.
Read three groups of permissions
A long listing uses r, w and x for read, write and execute. Those permissions are grouped for the owner, group and others. A dash represents a missing permission bit.
ls -lUnderstand the digits
Each octal digit adds read (4), write (2) and execute (1). In 644 the owner has read and write; group and others have read only. In 755 the owner also has execute, and group and others have read and execute.
stat deploy.shAdd execute access deliberately
chmod +x adds execute bits. In our fixture the script starts at 644, so the resulting mode is 755. Before executing a real script, inspect its contents and understand what it does.
chmod +x deploy.shUse the narrowest access you need
A private script may only need owner access, represented by 700. Avoid setting everything to 777 as a troubleshooting shortcut. Our permissions lessons manipulate metadata; the simulation does not enforce an operating-system access model.
chmod 700 deploy.shMake it stick.
Try the matching guided exercise in your browser. The first 10 exercises are free; later exercises require a plan.
Practice this skill →