The Hosts file – here today, gone today!

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)
   at System.IO.FileStream.Init(…)
   at System.IO.FileStream..ctor(…)
   at System.IO.StreamReader..ctor(…)
   at System.IO.FileInfo.OpenText()
   at Microsoft.Search.Administration.Security.HOSTSFile.ParseHOSTSFile(…)
   at Microsoft.Search.Administration.Security.HOSTSFile.ConfigureDedicatedGathering(…)
   at Microsoft.Office.Server.Search.Administration.SearchServiceInstance.SynchronizeDefaultContentSource


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

Brad

Advertisements

About Brad Saide

I'm a SharePoint consultant. I'm also slowly going bald, seem to have a permanent spare tyre around my waist and enjoy socialising with friends over a beer or 10. The last 2 may possibly be related. Started working with SharePoint when the first version was in limited beta release (participated in the Technology Adoption Program while at Woolworths) and have been committed to the adoption of the technology as a business enabler ever since.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s