name of my macbook air changed automatically [duplicate]
Solution 1:
It's perfectly normal for this to occur; when you login Terminal remotely bash does a reverse DNS lookup. It will only be the same if the hostname is not specified on the network you're connecting from and there is no reply from the DHCP server, or the reverse lookup against the remote DNS server fails to resolve.
You can easily over-ride the default setting by using this command in Terminal:
sudo scutil --set HostName archos
You can check it by using:
nslookup nn.nn.nn.nn
( or )
host nn.nn.nn.nn
(where nn signifies your Mac's ip address)
Solution 2:
There are some helpful comments below this answer that you might want to read first.
Go to System Preferences -> Sharing and update your Computer Name.
Then in Terminal, you can view settings via:
sudo scutil --get ComputerName
sudo scutil --get LocalHostName
sudo scutil --get HostName
You can also change the values using the scutil
command:
sudo scutil --set ComputerName "newname"
sudo scutil --set LocalHostName "newname"
sudo scutil --set HostName "newname"