hostname change..

and the next thing is the hostname.

Permanent hostname change on RedHat based systems

RedHat based system use the file /etc/sysconfig/network to read the saved hostname at system boot. This is set using the init script /etc/rc.d/rc.sysinit

/etc/sysconfig/network
NETWORKING=yes
HOSTNAME=”plain.domainname.com”
GATEWAY=”192.168.0.1?
GATEWAYDEV=”eth0?
FORWARD_IPV4=”yes”

So in order to preserve your change on system reboot edit this file and enter the appropriate name using the HOSTNAME variable. Use sysctl to change the hostname

Why would someone need a different method of doing the same thing as above? No idea, but here is anyway: use sysctl to change the variable kernel.hostname: Use:

sysctl kernel.hostname

to read the current hostname, and

sysctl kernel.hostname=NEW_HOSTNAME

to change it.

Related Post

2 Responses

  1. ahstod says:

    I have the same issue with eeebuntu on eeepc too, sudo this, sudo that.

    And feels weird typing my own password instead of root’s.

    what to do, stuck with centos/rhel for work … and since use the work machine so much, might as well make the other home machines the same for familiarity (except for the eeepc, for which the default centos is a bit too slow).

    Reply
  2. HawkEYE says:

    that remind me on one event at one of my project site.
    requirement was easy..
    “need to set a new ip address to the machine.”

    and the machine happened to be running Ubuntu 7.10 (Gutsy Gibbon) because someone else already installed it earlier..

    First few minute wasted to guess the root password as the one who installed it also not quite familiar..

    then only realized it need normal user password instead of root password.. (one of occupational hazard i think.)

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *