linux question #2

Discussion in 'OT Technology' started by D1G1T4L, Feb 4, 2004.

  1. D1G1T4L

    D1G1T4L Active Member

    Joined:
    May 4, 2001
    Messages:
    16,489
    Likes Received:
    0
    Location:
    Bay Area
    i am trying to change the host name on my linux box, i use
    hostname smoke

    and it seems to change but as soon as i reboot, i get

    localhost login:

    screen instead of

    smoke login:
     
  2. col_panic

    col_panic calm like a bomb Moderator

    Joined:
    Sep 19, 2003
    Messages:
    188,160
    Likes Received:
    0
    Location:
    winter haven, fl
    edit the /etc/hosts file and where it says 127.0.0.1 localhost add "smoke" (without the quotes) after the ip address
     
  3. D1G1T4L

    D1G1T4L Active Member

    Joined:
    May 4, 2001
    Messages:
    16,489
    Likes Received:
    0
    Location:
    Bay Area
    why doesnt it work with hostname command?
     
  4. D1G1T4L

    D1G1T4L Active Member

    Joined:
    May 4, 2001
    Messages:
    16,489
    Likes Received:
    0
    Location:
    Bay Area
    btw /etc/hosts it says
    Code:
    127.0.0.1 localhost.localdomain localhost
    
    and i thought hostname command changes the host file, so why would it matter if i did it manually
     
    Last edited: Feb 4, 2004
  5. col_panic

    col_panic calm like a bomb Moderator

    Joined:
    Sep 19, 2003
    Messages:
    188,160
    Likes Received:
    0
    Location:
    winter haven, fl
    yeah, i don't know why hostname doesn't do it for you. you can replace localhost.localdomain with smoke and it should work fine.

    you can do anything manually in linux if you know how ;)
     
  6. SLED

    SLED build an idiot proof device and someone else will

    Joined:
    Sep 20, 2001
    Messages:
    28,118
    Likes Received:
    0
    Location:
    AZ, like a bauce!
    i think the distro you are using has a config file somewhere which will overwrite what is in your /etc/ config. You need to figure out where that config file is, and change it there
     
  7. col_panic

    col_panic calm like a bomb Moderator

    Joined:
    Sep 19, 2003
    Messages:
    188,160
    Likes Received:
    0
    Location:
    winter haven, fl
    ^ that would suck. what distro is this anyway?
     
  8. RaginBajin

    RaginBajin Have you punched a donkey today?

    Joined:
    Dec 24, 2001
    Messages:
    8,740
    Likes Received:
    0
    Location:
    NoVA
    I had the same issue with RedHat 9.. I just changed the hostfile, and set the hostname using the command hostname and all was well..
     
  9. D1G1T4L

    D1G1T4L Active Member

    Joined:
    May 4, 2001
    Messages:
    16,489
    Likes Received:
    0
    Location:
    Bay Area
     
  10. Joe_Cool

    Joe_Cool Never trust a woman or a government. Moderator

    Joined:
    Jun 30, 2003
    Messages:
    299,566
    Likes Received:
    621
    Your hostname also gets set in one of the script files (I can't remember which off the top of my head). If it's Redhat 9, run a program in X called "redhat-config-network" and change the hostname there. It will update it everywhere that needs it.
     
  11. crontab

    crontab (uid = 0)

    Joined:
    Nov 14, 2000
    Messages:
    23,459
    Likes Received:
    12
    The file you should be changing is /etc/sysconfig/network Change the HOSTNAME=localhost to HOSTNAME=smoke. That's where you add your default router and other things as well.

    Although you can change your /etc/hosts 127.0.0.1 names, it's recommended not to for some applications. The real hostname of your machine should be associated with the drop it's on, so your host table should look like:

    bash-2.05$ more /etc/hosts
    # Do not remove the following line, or various programs
    # that require network functionality will fail.
    127.0.0.1 localhost
    192.168.1.100 smoke

    Or whatever static ip it is, assuming your not using dhcp.

    Programs like Legato Networker become funky if you point your hostname to 127.0.0.1.

    -crontab -l
     
  12. col_panic

    col_panic calm like a bomb Moderator

    Joined:
    Sep 19, 2003
    Messages:
    188,160
    Likes Received:
    0
    Location:
    winter haven, fl
    good call chrontab - i did not know that :)
     
  13. jayrod

    jayrod Lurker extraordinaire...

    Joined:
    Jul 19, 2001
    Messages:
    2,663
    Likes Received:
    0
    and if you ARE using dhcp?
     
  14. crontab

    crontab (uid = 0)

    Joined:
    Nov 14, 2000
    Messages:
    23,459
    Likes Received:
    12
    Then you will get the ip, hostname, domain, dns from the dhcp server depending on how it's set up.

    To toggle dhcp, you edit BOOTPROTO=dhcp in your /etc/sysconfig/network-scripts/ifcfg-eth#, # is the interface that responds to dhcp, to BOOTPROTO=static, and enter your IPADDR, NETMASK, BROADCAST, and ONBOOT.
     
  15. D1G1T4L

    D1G1T4L Active Member

    Joined:
    May 4, 2001
    Messages:
    16,489
    Likes Received:
    0
    Location:
    Bay Area
    crontab do you work as a unix admin or what?
     
  16. crontab

    crontab (uid = 0)

    Joined:
    Nov 14, 2000
    Messages:
    23,459
    Likes Received:
    12
    unix admin
     
  17. D1G1T4L

    D1G1T4L Active Member

    Joined:
    May 4, 2001
    Messages:
    16,489
    Likes Received:
    0
    Location:
    Bay Area
    nice... get paid well?
     
  18. crontab

    crontab (uid = 0)

    Joined:
    Nov 14, 2000
    Messages:
    23,459
    Likes Received:
    12
    I survive.
     

Share This Page