Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have about 100 users with Mac Books on which I have admin access. I have set up a dnsmasq DNS-Server on a Linux box that has the Domain "schoolnet". Now I have the problem, that all Mac Books have a ComputerName and a LocalHostName (which is the same as ComputerName but with "-" instead of space), but no HostName defined.

On the network they all register with the hostname "localhost" I would like them to have the same HostName as their LocalHostName.

How could I achieve that with a scutil command I could send to them?

share|improve this question

1 Answer 1

This can be done rather easily, programatically.

COMPUTERNAME="$(scutil --get LocalHostName)" && scutil --set HostName $COMPUTERNAME

Here we set COMPUTERNAME variable to the value contained in LocalHostName, and sets the HostName accordingly.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.