Search code examples
macoscommand-lineterminalserverterminal-server

dhcp in Mac Terminal - is this spying?


"dhcp35:~ user$" has appeared in my mac terminal instead of the usual "My-MacBook-Pro:~ user$".

Is this an indication of anything malicious?

I've been messing around cliclick to automate key presses from terminal, so not sure if this has resulted from my messing or from something I might have downloaded.

dhcp is documented as part of the terminal server user guide, but I can't work out the significance.


Solution

  • I suspect you are connected to a DHCP server that sets the hostname along with giving an IP assignment:

    https://www.rfc-editor.org/rfc/rfc2132#section-3.14

    One way to stop the hostname from changing is to do the following from a Terminal window (assuming you want to name your computer donald). You may need to preface these commands with sudo:

    scutil --set ComputerName    donald
    scutil --set HostName        donald
    scutil --set LocalHostName   donald