Somehow my Localhost got renamed...

Snyper M

Registered
Ok I'm sure everybody knows that when they go int oterminal they should get a prompt like this:

[localhost:~] michaelc%

Well for some reason upon returning home from college for the holidays my Local ISP decided to modify that. I plugged my G4 into the network and now whenver I go into the terminal i get this for a prompt:

[h00039347ff1a:~] michaelc%

Now If I go into the server's folder in the finder and take a look at the servers available, the alias to what is normally "localhost" is now h00039347ff1a..... etc.

Is this a problem? Can I fix it? "localhost" looked much less cryptic. And how did this happen, is Mediaone screwing with me? It worked fine on campus without any name changes...
 
I feel your pain, Snyper. Although your computer will still recognize the meaning of "localhost" it won't appear in your prompt if some other name has been assigned to your computer by MediaOne's DHCP server. I'm really not sure what can be done about it. On my Mac at work the terminal prompt becomes [dhcp174:~] when I connect to the LAN.

One major drawback I found was that if I tried to connect to MySQL in a PHP script MySQL would refuse the connection because it was getting a message that I was trying to connect from "localhost.ptld.qwest.net" and I didn't have permission to connect from that domain. (I fixed this by telling MySQL to allow connections from localhost.ptld.qwest.net.)

The ultimate solution, whatever it may be, would probably involve mucking with NetInfo Manager. One thing I remember about this behavior is that it didn't appear until Mac OS X 10.0.4. Before that the host name seemed unaffected by LAN/DSL connections. If you have a spare partition where you can install an older version of Mac OS X you might be able to compare settings in NetInfo and see what Apple changed, if anything.

Meanwhile if this annoys you you can edit the following file:

/usr/share/init/tcsh/tcsh.defaults

Replace the line which reads:

set prompt = "[%m:%c3] %n%# "

with this:

set prompt = "[localhost:%c3] %n%# "

...Or put anything you want in there (i.e., your Mac's nickname). The special combination %m is always going to refer to your machine anyways so there's no special reason to have it in there.
 
That behaviors strange in my opinion as my routers DHCP server keeps it at localhost.
 
I had the same issue with Comcast until I switched to using a router - the router is now using the DHCP client id stuff. I know it didn't hurt anything, but it just bugged the crap out of me! Same thing happens when I can't throw empty the trash on some strange file that is 4k or something - I become obsessed!:eek:
 
I run a static private ip for my lan and i have my router get the dhcp ip from my cable modem.

All I did was change the hostconfig file (shown below) to change the 'localhost' to 'GFoe'

I am not 100% sure what other items such as MySQL or any other apps may respond to this setting.. your milage may vary.


##
# /etc/hostconfig
##
# This file is maintained by the system control panels
##

# Network configuration
HOSTNAME=GFoe #-AUTOMATIC-
ROUTER=-AUTOMATIC-

# Services
AFPSERVER=-YES-
APPLETALK=en0
AUTHSERVER=-NO-
AUTOMOUNT=-YES-
CONFIGSERVER=-NO-
IPFORWARDING=-NO-
MAILSERVER=-YES-
MANAGEMENTSERVER=-NO-
NETINFOSERVER=-AUTOMATIC-
RPCSERVER=-AUTOMATIC-
NETBOOTSERVER=-NO-
NISDOMAIN=-NO-
TIMESYNC=-YES-
QTSSERVER=-NO-
SSHSERVER=-YES-
WEBSERVER=-NO-
APPLETALK_HOSTNAME=Gfoe
 
Back
Top