chmod: Symbolic Mode
The chmod command changes file permissions. In symbolic mode, you specify:
- Who:
u(user/owner),g(group),o(others),a(all) - Action:
+(add),-(remove),=(set exactly) - Permission:
r,w,x
Adding execute permission for the owner
chmod u+x script.sh
Now the owner can run script.sh as a program.
Removing write permission from group and others
chmod go-w secret.txt
Group and others can no longer modify this file.
Setting exact permissions
chmod u=rwx,g=rx,o=r file.txt
This sets owner to full access, group to read+execute, others to read only.
Multiple changes at once
chmod u+x,g-w file.txt
Add execute for user AND remove write for group in one command.
After each chmod, verify with ls -l to confirm the change took effect.
Mission: Activate the Firmware Deployer
A critical firmware update is ready in deploy.sh, but the script cannot run yet, and it also carries sensitive settings that outsiders should never read.
- Give the owner permission to run
deploy.shas a program. - Remove read access from others on
deploy.shso outsiders cannot view it. - Confirm the changes by viewing the file's detailed permissions.
- Create a folder called
deploy-readyand copydeploy.shinto it.
Expected result
deploy.sh is executable by the owner and unreadable by others, and a copy sits in deploy-ready.