Change scutil HostName to ComputerName on osx

1

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?

NateMoor

Posted 2014-02-04T14:03:35.807

Reputation: 11

Answers

0

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.

Nick

Posted 2014-02-04T14:03:35.807

Reputation: 281