Chapter 7: Static Website Hosting (3 OSes × 2 Web Servers)
7.5 Step 3 (common): copy files and set permissions
Friends, the files are in your home folder; now let's copy them into the web root and set the permissions – folders 755, files 644. Get this one step wrong and you get a 403.
मित्रांनो, फाइल्स होममध्ये आल्या, आता त्या वेब रूटमध्ये कॉपी करू आणि परमिशन्स सेट करू – फोल्डर्स 755, फाइल्स 644. ही एकच स्टेप चुकली तर 403 येतो.
दोस्तों, फ़ाइलें होम में आ गईं, अब उन्हें वेब रूट में कॉपी करेंगे और परमिशन्स सेट करेंगे – फ़ोल्डर्स 755, फ़ाइलें 644. ये एक स्टेप गलत हुआ तो 403 आता है.
sudo mkdir -p /var/www/mysite
sudo cp -r ~/mysite/* /var/www/mysite/
sudo find /var/www/mysite -type d -exec chmod 755 {} \;
sudo find /var/www/mysite -type f -exec chmod 644 {} \;
ls -la /var/www/mysite
Now follow the section for your combination.
Ravindra Bagale's Tip
Before blaming the web server, test from inside the server with curl -I http://localhost. If this works but the browser doesn't, the problem is outside (security group, firewall, IP, https). If it fails from inside too, check the service and the error log. This one test cuts your troubleshooting time in half.
Ravindra Bagale's Tip – मराठी
Web server ला दोष देण्याआधी server च्या आतून curl -I http://localhost ने test करा. हे चाललं पण browser नाही, तर problem बाहेर आहे (security group, firewall, IP, https). आतून पण fail झालं तर service आणि error log बघा. ही एकच test तुमचा troubleshooting चा वेळ अर्धा करते.
Ravindra Bagale's Tip – हिंदी
Web server को दोष देने से पहले server के अंदर से curl -I http://localhost से test करो. यह चल गया पर browser नहीं, तो problem बाहर है (security group, firewall, IP, https). अंदर से भी fail हुआ तो service और error log देखो. यह एक test तुम्हारा troubleshooting का समय आधा कर देता है.
Lab
Chala, varchya commands ne /var/www/mysite banva aani files copy kara. Mag ls -la /var/www/mysite madhe folders drwxr-xr-x aani files -rw-r--r-- distat ka te check kara, aani namei -l /var/www/mysite/index.html chalva.
Extended teaching notes
Why this lesson matters
Cloud security is mostly IAM, network exposure, logging and secure defaults. The shared responsibility model means the provider patches the metal; you patch what you configure.
- No public databases or public admin panels.
- Roles / OIDC instead of long-lived access keys.
- CloudTrail / Activity Logs / Audit Logs on and retained.
- S3/Blob/GCS: Block Public Access; encrypt; least privilege.
Mini case study
Suppose we are on a purple-team exercise for an Indian mid-size company (sample data). Red notes a technique from this lesson against a lab clone. Blue must show the control that stops it, the log that would have fired, and the ticket that hardens production. That is the standard this course trains you for.
Defender's worksheet (do this today)
- Write the lesson title, date and the exact lab target you are allowed to use.
- List three owned systems (VMs, apps, or cloud accounts) where this lesson applies.
- Run one safe check from the lesson on a lab system only. Paste the command and output.
- Write a two-sentence fix you would give a teammate.
- Name one related public advisory (CERT-In, CISA, NVD, or a vendor bulletin) with its date.
Indian workplace (sample data)
Suppose we are a junior analyst at Infosys, TCS, Wipro or a fintech SOC in Bengaluru/Pune. Turn this lesson into one checklist item with an owner, a due date and a place to store evidence (ticket + screenshot).
Global practice
Compare your notes with OWASP, CIS Benchmarks, NIST CSF/IR guidance or a cloud Well-Architected security question. Write five lines on what overlaps.
Everyday analogy
Explain the risk and the fix to a family member without jargon. If they can repeat the warning, you understand it well enough to teach juniors.
Key terms
- Control: a safeguard (patch, config, process, detection).
- Finding: a weakness backed by evidence.
- Remediation: the fix plus how you verified it.
- Scope: systems you have written permission to touch.
- Least privilege: only the access the task needs.
- Defence in depth: several layers so one failure does not end the story.
Common mistakes
- Skipping written permission "just for a quick scan".
- Practising on hostel, office or public targets without authorisation.
- Collecting tool output without writing the fix.
- Copying attack steps onto production to "verify". Defenders verify with versions, configs and patches.
- Publishing screenshots that contain secrets, cookies or internal hostnames.
Recap
- Evidence, fix, owner, date.
- Own lab only.
- Fix > spectacle.