Soru

Zorluk: OrtaMicrosoft Command-Line Tools

A desktop technician needs to update the local host name resolution file (`hosts`) on a Windows workstation to redirect a legacy internal domain. The existing `hosts` file in `C:\Windows\System32\drivers\etc` is marked as read-only and hidden. Order the steps from first to last that the technician should perform to complete this modification securely.

  1. 1Open Command Prompt as an Administrator.
  2. 2Execute `attrib -r -h hosts` within the `C:\Windows\System32\drivers\etc` directory.
  3. 3Edit and save the updated entry inside the `hosts` file.
  4. 4Execute `attrib +r +h hosts` in the same directory.

Cevap

The technician must first open Command Prompt with administrative privileges, execute `attrib -r -h hosts` to clear the file attributes, save the edits to the `hosts` file, and finally run `attrib +r +h hosts` to re-secure the file.
To modify system files located in system directories, administrator privileges must be used first. System files like the local `hosts` file frequently have read-only (`r`) and hidden (`h`) attributes set. Using `attrib -r -h` removes these flags so edits can be saved. After editing, re-applying the flags with `attrib +r +h` maintains workstation security and system integrity.

Adım Adım Çözüm

1
Elevate permissions
Command Prompt runs under administrator context
Modifying files inside `C:\Windows\System32\drivers\etc` requires local administrative rights.
2
Remove file attributes using `attrib -r -h hosts`
The file is no longer read-only or hidden
The `-r` parameter removes the read-only lock and `-h` unhides the file, permitting modification.
3
Update the host mappings
The target domain mapping is written and saved to disk
Editing can only succeed after write restrictions are stripped from the target file.
4
Re-apply file attributes using `attrib +r +h hosts`
The read-only and hidden attributes are restored
The `+` operator enforces system file protection best practices after editing is completed.

Anahtar Kavram

Managing file attributes using the Windows `attrib` command-line tool
Tahmini Süre:1m 30s
Bu soruyu puanla