Previous 1 2 Next 18 Replies Latest reply: Apr 13, 2008 4:44 AM by SteveLamb0
counterpt Level 1 Level 1 (5 points)

I have a clean install of leopard. I also signed up for the trial .mac account (I'm not sure if this is affecting anything).

I want to change the name of the computer.
So I go to the preference pane and sharing and change the name.
But when I start the terminal, it shows the old compute name:
(old computer name):~ (username)$

Am I missing something. Which computer name is correct what it says in the shell in terminal or what the sharing preference pane is telling me (new name).local

I know I have changed the name successfully in the past few days, I don't know why it's stuck now.

This is the last time I want to change the name! The reason I want to change it is because the old name has my name in it and I don't want to connect to a network and have people identify me (nothing subversive just privacy! I'm a teacher and I don't want students trying to hack my notebook because they realize it's mine).

My account is an admin account.

Thank you for any help.

MacBook Pro 2 GHz core duo, Mac OS X (10.5.1)
  • Topher Kessler Level 6 Level 6 (9,790 points)
    You can change the computer name in the "Sharing" Preference Pane at the top in the field labeled "Computer Name". Try fixing permissions to see if that will let the new name implement somewhere. It should change the terminal settings.
  • counterpt Level 1 Level 1 (5 points)
    Thank you, I repaired permissions as you suggested and then changed the computer name again but in terminal it still shows the old name.
  • Will Bridewell Level 1 Level 1 (5 points)
    Hi, I just wanted to mention that I'm having the same problem. I switched computer names in the Sharing pane, but Terminal and xterm both display the old computer name. My computer appears with the correct name on my local network, so I'm not sure how Terminal is getting the old name.
  • Will Bridewell Level 1 Level 1 (5 points)
    I've hunted around, and I can think of two things.

    1. Terminal is weird. It doesn't respect the hostname set in the Sharing pane, but if you issue the command

    sudo hostname <new host name>

    quit Terminal, and then reopen the application, the new hostname should appear. From what I can tell, the name in the Sharing pane is the one displayed on the network. I don't know why the two names are disconnected in Leopard.

    2. It may be the case that your computer, when connected to the network, is assigned a hostname by the DHCP server. If so, then you need to contact the system administrator and request that your hostname be changed at the server level.
  • Topher Kessler Level 6 Level 6 (9,790 points)
    Where you enter teh computer name, try editing the local name (teh "Edit..." button under the computer name field).
  • Tim Campbell1 Level 3 Level 3 (575 points)
    'Terminal' app is a bit different. The default prompt shows the hostname as it resolve from DNS (or whatever service you use to resolve hostnames).

    You can do a 'man bash' to see the manual page for the bash shell (the man page for bash is very long) and keep paging down until you find the definition of 'PS1' (which is the default host prompt for the bash shell). You can type (in the Terminal window shell prompt) "echo $PS1" to see the current value of the PS1 variable. Mine looks like this:

    \h:\W \u\$

    The "\h" part resolves to display whatever the 'hostname' command would have printed UP TO THE FIRST "." (ie. it wont display the domain name. It's as though you typed 'hostname -s' in the terminal to view the hostname.). If you changed it to "\H" (upper case 'H') then it would display the entire hostname.

    You can use the 'hostname' command to change the hostname, but this will not be saved permanently (if you reboot it will revert back to whatever it was).

    Since the displayed hostname is actually based on DNS (or whatever network name service you happen to use) if someone wanted to contact your computer they could use that name or they could use the the name you provided in the 'Sharing' panel of system preferences.
  • counterpt Level 1 Level 1 (5 points)
    It's a fresh install, I still have my backup disk.
    I'm just going to reinstall and set it right from the beginning

    Boy this feels like a inelegant windows solution....

    Thanks again for all the help
  • Topher Kessler Level 6 Level 6 (9,790 points)
    For me the Terminal echoes whatever I put in the computer name field, regardless of whether or not I'm connected to a network. This guy's problem is that the terminal name is not changing, and I suspect something in his OS X configuration is preventing the computer name he inputs from being written to the configuration file that defines the hostname, so when bash looks up \h for the hostname, it doesnt get a changed value. This behavior is unlike my system, which does change the hostname according to what I type in for the computer name.
  • counterpt Level 1 Level 1 (5 points)
    Thanks again.
    I'm going to reinstall. I'm not going to activate .mac, and not install anything goofy (I tried intego netbarrier (big mistake) and I'm not sure if that did anything deep in the OS).
  • Eduardo Rolon Level 1 Level 1 (25 points)
    I think it is too late to avoid the reinstall and it will not solve your issue, but you can try the following.

    Go into your network settings and change "using DHCP" from dynamic to "Using DHCP with manual address" input a new address and that should fix it. The culprit is the router that it is pulling the old name therefore forcing the router to clear its "cache" will change the name, also restarting might work. The end result is that having the name be different is of no consequence except to us people that like things neat.
  • Slawo Level 1 Level 1 (0 points)
    Using hostname will not change the host name. The entry in the sharing preferences pane will.
    I actually had to reboot my modem to get the correct host name displaying in the terminal and in the various links in the sharing properties.

    So it was a network issue.
  • bbolin Level 3 Level 3 (520 points)
    Changing the host name on a Unix based OS will require starting and stopping the network service or rebooting for it to appear everywhere.
  • Russa Level 4 Level 4 (1,315 points)
    Are you trying to change the short account name? If so, it cannot be changed. I think this is the name that appears in Terminal.

    You can right click on the name of the hard drive on the desktop and change its name.

    You can go into System Preferences and change the name of the shared device by clicking on "Edit" button in the Sharing window.
  • SteveLamb0 Level 5 Level 5 (4,110 points)
    Hi Russa

    Russa wrote:
    Are you trying to change the short account name? If so, it cannot be changed.

    In Leopard, you can change your shortname but it is to be done with extreme caution.

    System Preferences>Accounts.
    Click padlock & authenticate to unlock (if locked)
    Right-click name of your Admin account in left-hand list.
    Click Advanced Options.

    Stuff you can change:

    Group ID
    Short Name
    Login Shell
    Home Directory

    Like I said, this requires extreme caution (read warning at top of that window).
Previous 1 2 Next