Someone else's computer name showing up in terminal??

Okay -- here's a strange one -- I rebooted my computer and happened to notice that when Terminal launched upon reboot, someone else's computer name (melbalaptop) showed up in the Terminal prompt:

User uploaded file

Any thoughts???

Cheers!

Andrew

Posted on Apr 25, 2015 1:19 PM

Reply
6 replies

Apr 25, 2015 7:16 PM in response to theolog

Just a guess, but the simplest explanation is that you unwittingly connected to a (WiFi) network with a DCHP server that allocated you an ip address and hostname. It's run by someone who doesn't know what they doing, probably a neighbour's kid who is 'good with computers'. Another possibility is that someone is running a rogue DHCP server on your own network.


You can may be able to figure out which one by reviewing the Console.app logs, e.g. 'wifi.log' at the bottom of the list in the sidebar, around the time you rebooted.


Review and the list of WiFi networks you have previously connected to in your network settings and prune any that you don't recognise as being ones you want to connect to.


C.

Apr 26, 2015 4:41 PM in response to theolog

As Linc explains the bash shell does a reverse DNS lookup taking your IP address you got from the local DHCP server, and tries to get the name that was associated with the IP address from the DNS server.


Many times the local router is the DNS server. If there are Windows systems on the same network, many times they send their name to the DNS server telling it that when they are using that exact same IP address it should be called melbelatop or some other name. Since the Mac does not tell the local DNS server its name, the local DNS server does not change it, and when bash asks for the name, it gets the last thing the DNS server knew about.


Now if the DNS server does not have an name, then the Mac gives bash the System Preferences -> Sharing -> Computer name.


Linc also gave you a command that can force the name to what you want.


And you can always change your bash PS1 variable to specify whatever you want, and NOT use the \h PS1 prompt option that causes bash to perform the reverse DNS lookup (that is my solution, as you would not believe the length of the DNS name my company gives to DHCP assigned IP addresses; it must be 40 or 50 characters long using up most of the command line just for the prompt 😁).

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Someone else's computer name showing up in terminal??

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.