All jobs / DevOps / SRE / cloud / Linux
DevOps / SRE / cloud interview question · 0–1 years
`./deploy.sh` says “Permission denied” and `ls -l` shows `-rw-r--r--`. What do you do?
The strongest answer
Add the execute bit for the owner — `chmod u+x deploy.sh` (or 755 if others run it) — and commit the mode so the pipeline gets the same file
Why it works
Right — r, w and x are separate bits, and the file needs x to be run directly. Fixing the mode fixes it for everyone who checks it out.
What a good answer covers
- Read the mode before you change it.
- r, w, x — owner, group, others.
- Add only the bit that is missing.
- Never reach for 777.
Answers that fall short
- Close, but not the strongest: Run it as `bash deploy.sh`; the shell reads it as input, so the execute bit does not matter
That works today, but it leaves the file broken for the next person and for the pipeline that calls it directly. - Weak: Run it with `sudo`; permission errors mean you need to be root
Root is not the missing bit; sudo would run a non-executable file into the same error and teaches a bad reflex. - Red flag: `chmod 777 deploy.sh` so nobody ever hits this again
World-writable means anyone on the box can rewrite what your deploy runs. Interviewers hear 777 as “I do not know what the bits mean.”
Who gets asked this
More Linux questions
- What do you check, and what was the likely mistake?
- Everyone SSHes as root with the same key. What do you change first?
- A service fails to start with “address already in use” on port 8080. How do you find out what holds it?
- A runbook installs a CLI on every server with `curl https://… | sudo bash`. What do you prefer, and why?
- A deploy script failed on step two (the build), carried on, and pushed an empty artifact to production. What…
- `df -h` says the root volume is 100% full. `du -sh /` adds up to less than half of that. What is going on…
- Load average is 40 on an eight-core VM, yet `top` shows CPU mostly idle and the app is crawling. What does…