So, your Mac has a name, and it identifies itself as such when other computers connect to it via Apple file sharing, the command line (like when using Terminal), or via Bonjour or AirDrop. Typically, you can set this name in the Sharing Preferences panel in the System Preferences app. If you put your name into the setup wizard when you set up a new Mac, the networking name will default to “Firstname Lastname’s MacintoshModel.” So, on my Macbook Air, it said, “Rob’s Macbook Air.”
However, you can set these three networking names to display differently, so that your IT support staff sees one name when she logs in via SSH protocols, your boss sees a different name when they connect to your hard drive to grab that important file, and your coffee shop buddy will see an entirely different name when sending you a funny picture via AirDrop.
First up, launch Terminal from your Utilities folder, which can be found in the Applications folder. Once it’s open, type the following command to set your ComputerName, which is the same as the one in the Sharing preference pane.
scutil --set ComputerName "HappyAndSadMac"
Of course you can set whatever name you want between the quotation marks in the command above. Once you do, you’ll also need to type in your administrative password to make this work. If you get an “invalid command” error, be sure to use a name without spaces.
To set the HostName, which is the geeky name you can see from the command line and when you connect to your Mac via SSH or remote login apps, type or paste in the following line:
scutil --set HostName "IsaacAsimov"
Finally, to set the LocalHostName, type or paste in the following line, and your Mac will identify itself this way to Bonjour browser apps and AirDrop.
scutil --set LocalHostName "AdorableMe"
Now you can have your Mac wear a different name for each different connection, and your IT support person will like you just that bit more.
Via: OS X Daily.