4

When I open up a command line on my Mac the welcome message is usually

Last login date
Johns-MacBook-Pro$

This now reads...

Last login: Fri Dec 18 23:48:34 on ttys000
Johns-MBP-2:~ johnw$

What does the -2 mean and why did this change? In between noticing these changes I moved between two different wireless networks; one being a regular Fi-Fi network, and the other being a portable hotspot off of a cell phone. I also downloaded a zip file. Could this be a virus? This doesn't appear so as running users only returns my name and running ac -p returns

root         0.05
johnw     7452.99
total     7453.04 

Can someone please explain me to me why this changed? I do see setting hostname change in the console.

network changed: v4(en1!:my ip address from phone) DNS+ Proxy+ SMB
configd[24]: setting hostname to  "Johns-MBP-2" 

Is this from changing internet connections or could this be from malicious software? Or is this because I changed Wi-Fi credentials and opened new terminal windows when I had previous ones open from when I was using the other Wi-Fi networks?

1

This is a bug in the implementation of iOS/OS X in my eyes. What used to be a good thing is now a pain in the behind.

This has been something that people of Apple products have been dealing with since 2012 on a widespread basis. It's easier to fix on OS X where you can call the scutil command:

scutil --get ComputerName
scutil --set ComputerName "Whatever You Wish"

The only positive thing is that in some cases, people depend on host names so making the change visible in the terminal has some benefit for them, but it sure causes a lot of worry and concern when people see names they have chosen being ignored and reassigned/modified without any reasonable explanation as to why being presented to the user. On the practical end, there is absolutely no good way to prevent this renaming - either setting things up on the network router side or on OS X side given that the OS manage IPv4 and IPv6 and AirDrop and bluetooth networks and shuffle the network settings to accommodate many clients.

0

If you have another computer with the same hostname (probably on the network) your hostname might change.

One way this can happen (speaking from experience) is if you restore from a backup or some similar method, especially if you use Time Machine, because your TM backup is associated with the computer name and to avoid conflict your computer name won't be set to the existing hostname.

You can change your computer name by going to  Menu > System Preferences > Sharing > Computer name (at the top) (this name appears on AirDrop).

Your hostname will automatically be changed to be the same name (you can see it under the text box). If you want to change it, click "Edit..." under the text box.

0

Usually this is an effect you have in networks, where a so called DHCP server assigns dynamically network adresses to your devices. Additionally the DHCP server often also works as DNS server. For that it maintains a table with all the IP adresses already leased to the devices and their resp. Media adress (MAC Adress) and sometime the hostnames. Every entry has a lease time, after expiration the IP adress will be set free again and put back into the pool of available and assignable IP adresses.

Now you came along with your Mac and it is configured with a hostname "John's MBP" and you have been in the network before. IP Adress fetching is set up to by dynamic. Your Mac now gets an IP adress assigned to from your DHCP server and in parallel your MBP asks the DHCP server about the DNS entry about "John's MBP". Looking in its lease table, the DHCP server answers 1.2.3.4 because your MBP was some time ago within the lease time in this network.

Now MacOS is too stupid to realize it is the same entry that was put in the DHCP DNS table hours ago because the same device requested an IP adresse. To respect Bonjour broadcasting and therefore also AirDrop, it decides to switch the hostname and to add a number at the end of the hostname in case the original "John's MBP" will be back again in an unknown time and that would lead to Bonjour chaos.

That is the reason why configd changes your hostname. This happens always in DHCP and dynamic DNS table environments all the time. I stopped counting and opening tickets at tech support in my company. Currently my MBP has a counter at the hostname of 16. Nothing bad so far, no malware, no error, only devops stupidity in MacOS and DHCP dynamic DNS computing. :-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .