When I set up a SharePoint system, I like to ensure that it’s set up according to Microsoft’s “Least Privilege Access” rule. It means that if the site ever gets compromised, the user has no access to other resources except ones directly related to SharePoint.
I was at a client’s site recently running an upgrade. Only one failure – It said that it could not find the hosts file… so I recreated the hosts file and reran the upgrade. No problems this time. Once I’d finished however, I noticed that there were a lot of errors coming up in the event log:
Application Server Administration job failed for service instance Microsoft.Office.Server.Search.Administration.SearchServiceInstance (…).
Reason: Could not find file ‘C:\Windows\system32\drivers\etc\HOSTS’.
Techinal Support Details:
System.IO.FileNotFoundException: Could not find file ‘C:\Windows\system32\drivers\etc\HOSTS’.
File name: ‘C:\Windows\system32\drivers\etc\HOSTS’
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
The hosts file had disappeared again. Damn. Recreated it, but in about a minute it went again and these errors started up again. After a quick search, I uncovered this gem of an article which described the issue perfectly. It looks like the testing done for this feature was somewhat flawed.
The solution is to grant permissions to the folder that the hosts file resides in – once the hosts file is deleted, then the service can recreate the hosts file the way its creator intended.
Original article was here – http://blogs.msdn.com/jjameson/archive/2007/05/05/the-case-of-the-disappearing-hosts-file.aspx