Computers being renamed to localhost

sosnovsken
New Contributor III

Hi Everyone,

Has anyone seen an issue where computers get renamed to "localhost" on 10.9.2 and the latest version of the JSS?

I saw this thread here: https://jamfnation.jamfsoftware.com/discussion.html?id=5078, but I'm not sure it still applies. The .plist file it references isn't present in my base image that I created with AutoDMG. Any thoughts that people have would be great!

1 ACCEPTED SOLUTION

Brad_G
Contributor II

I ran into this in my test environment. For me it was a Configuration Profile. In CP under the Login Window section, choose Options, and it was the "Set computer name to computer record name" that was erasing the name and putting localhost in the computer name field. It didn't modify the .local name in the Sharing pane.

My account rep was going to look into recreating it but don't know if he did. I didn't look at the log file to see if there was anything in there however.

View solution in original post

11 REPLIES 11

sosnovsken
New Contributor III

It looks like I've found the relevant log line:

5/4/14 2:43:24.961 PM mDNSResponder[65]: User updated Computer Name from “mac-sosnovsken” to “localhost”

Brad_G
Contributor II

I ran into this in my test environment. For me it was a Configuration Profile. In CP under the Login Window section, choose Options, and it was the "Set computer name to computer record name" that was erasing the name and putting localhost in the computer name field. It didn't modify the .local name in the Sharing pane.

My account rep was going to look into recreating it but don't know if he did. I didn't look at the log file to see if there was anything in there however.

jaferguson
New Contributor II

I have lots of computers that seem to have changed their name from our standard naming scheme to "localhost". It doesn't seem to be limited to Mavericks computers. Not sure what the cause is at this point.

sosnovsken
New Contributor III

Preliminary results seem to show Brad_G's solution working perfectly. That is a really odd place for apple to put that setting... and I think it gets set by default.

I'll mark this as the answer and chime back in if it starts up again.

edit: nevermind, it doesn't get set by default. I must have just been click happy.

BVikse
New Contributor III

I am having the same issue. I now have 200+ computers called localhost. I noticed that the dns name and remote management names are unchanged. Could anybody who is good with scripts write one for me to change the computer name to match the dns name?

sosnovsken
New Contributor III

This should do it. Just scope it to a smart group where computers have name localhost:

#!/bin/sh

SETNAME=`scutil --get LocalHostName`

jamf setcomputername -name $SETNAME

exit 0

BVikse
New Contributor III

@sosnovsken Thank you so much! Your script worked like a charm.

I tried to write a script to fix it and all it did was make things more confused. Luckily I only scoped my attempts to my office computers, lol.

Cook
New Contributor II

Syntax error in the script?

Script result: /Library/Application Support/JAMF/tmp/localhostfix.sh: line 1: {rtf1ansiansicpg1252cocoartf1265cocoasubrtf190: command not found /Library/Application Support/JAMF/tmp/localhostfix.sh: line 2: syntax error near unexpected token `}' /Library/Application Support/JAMF/tmp/localhostfix.sh: line 2: `{fonttblf0fmodernfcharset0 Courier;}'

sosnovsken
New Contributor III

I don't think so... this is about as basic as it gets. Did you get a curly brace inserted somehow (per the unexpected token } line that you got)?

Cook
New Contributor II

@sosnovsken

All happy days now. Worked a charm.

Cheers.

jjensen
New Contributor

Hi. The script worked wonders. However, the name changes back to "localhost." I've uninstalled and reinstalled the Casper client on the computers where it's happening, but that didn't help. Thoughts?