Skip to main content
Question

Computer names getting added to /etc/hosts file.


howie_isaacks
Forum|alt.badge.img+23

We have noticed that on some of our Macs the computer's name is getting added to /etc/hosts. This isn't having any negative effect on the operation of the Mac, but it does cause an issue with Tanium which queries the computer name as part of its data gathering tasks. These Macs display in Tanium as "localhost", not the name that is actually set for the Mac. We use the Mac's serial number for computer names. During initial setup, a policy runs "jamf setComputerName -useSerialNumber" I created an extension attribute that reads the contents of the hosts file and reports if the computer name is present. There have only been about 30 out of 1500. I created a script to remove the computer name, but on some of the Macs, the computer name has reappeared in the hosts file. Since this doesn't happen on all Macs, I'm not sure what could be doing this. Does anyone have ideas on what might be doing this?

2 replies

sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • 3540 replies
  • May 14, 2025

@howie_isaacks Can you correlate the timestamp of the /etc/hosts file being changed with any action from Jamf Pro or some app being run? I haven't seen it add a Mac's name to the /etc/hosts file, but Docker will add things to it


howie_isaacks
Forum|alt.badge.img+23
  • Author
  • Esteemed Contributor
  • 773 replies
  • May 14, 2025
sdagley wrote:

@howie_isaacks Can you correlate the timestamp of the /etc/hosts file being changed with any action from Jamf Pro or some app being run? I haven't seen it add a Mac's name to the /etc/hosts file, but Docker will add things to it


I have not yet done that, but I did notice that when I tested my policy to remove the computer name from the hosts file on my own Mac, I saw another hosts file named "hosts '" that was created at the same time my policy ran which remove the computer name from the hosts file. I read this file and it did have my computer name in it. I don't think (yet) that a policy in Jamf Pro is doing this but my investigation just started.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings