Why this happens
`C:\Windows\System32\drivers\etc\hosts` is a **protected system file**. Even Admin accounts need **elevated token** (UAC) + **Write DACL** on file. Default: `Administrators: (R, RX)` only. `SYSTEM: F`, `TrustedInstaller: F`.
Fixes (easiest → hardest)
1. Run Editor **As Administrator** (90% of cases)
- Close all Notepad/editor instances.
- Start → Type **Notepad** → Right-click → **Run as administrator** → Yes (UAC).
- File → Open → `C:\Windows\System32\drivers\etc\` → Bottom right "Text Documents" → **All Files** → Select `hosts` → Open.
- Edit → Save. **Works if UAC prompt accepted and AV not blocking.**
2. Check/Fix File Permissions (if #1 fails)
- Explorer → `C:\Windows\System32\drivers\etc\` → Right-click `hosts` → Properties → **Security** tab.
- Group/Users: Select **Administrators** (or your user) → **Edit** → Select Administrators → **Allow: Full Control** → OK → OK.
- If "Add" needed: Add "Administrators" → Check Names → OK → Full Control.
- Retry #1.
3. Temporarily Disable UAC (not recommended, but diagnostic)
- Start → "UAC" → **Change User Account Control settings** → Slider to **Never notify** → OK → **Reboot**.
- Try edit hosts (still run editor admin for consistency).
- **Immediately move slider back to default (2nd notch) → Reboot.**
4. Antivirus / Endpoint Protection Blocking
- Some AV (Bitdefender, Kaspersky, CrowdStrike, Defender ATP) **lock hosts** to prevent hijack.
- **Pause protection** (5-15 min) → Edit hosts → **Re-enable**.
- Or add **exclusion** for `C:\Windows\System32\drivers\etc\hosts` in AV settings.
5. SFC / DISM (system file corruption)
# Admin CMD / PowerShell
sfc /scannow
DISM /Online /Cleanup-Image /RestoreHealth
# Reboot → Try #1 again.
6. Take Ownership (Last resort)
- hosts Properties → Security → Advanced → **Owner: TrustedInstaller** → Change → Type **Administrators** → Check Names → OK → **Check "Replace owner on subcontainers and objects"** → Apply.
- Now Administrators own it → Edit Permissions (Step 2) → Full Control → Apply.
- Edit via Admin Notepad.
- **Optional:** Return ownership to TrustedInstaller (repeat step 1 with TrustedInstaller).
Common Hosts Entries (for reference)
# Block domain
127.0.0.1 analytics.google.com
0.0.0.0 ads.example.com
# Local dev mapping
127.0.0.1 myapp.local
192.168.1.50 server.internal
- **Encoding:** Save as **ANSI** (Notepad default) or **UTF-8 without BOM**. Not UTF-16.
- **No extension.** File name exactly `hosts`.
- **Flush DNS after edit:** `ipconfig /flushdns` (Admin CMD).
Malware Alert
If you **didn't edit it** and see unknown entries (banking sites → 127.0.0.1, or strange IPs) → **Malware modified hosts**. Run full scan (Malwarebytes + Defender Offline).
Bottom line: Run Notepad **as Administrator** + ensure **Administrators have Full Control** on file = fixes 99%. If AV blocks → exclude path.
- Cosa significa "snap" delle app in Windows 10
- Cosa accade al contenuto degli appunti quando spengo Windows? Viene perso per sempre
Social media
- --热点Computer