Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I should wait on this, but I'm gonna take a stab...
I believe you don't edit /etc/hosts to define your hostname, instead you would edit a file like /etc/HOSTNAME /etc/hostname or on some systems it's in a directory /etc/sysconfig/host
You could also temporarily set it with:
hostname newhostname
where newhostname is the hostname you want it to be. Note that after a reboot it will return to the default if it's not changed in the configuration file that your distro uses.
Originally posted by ppuru actually it is the file /etc/sysconfig/network, edit the
HOSTNAME=.
this will be available even after a reboot.
a quicker way - edit
/proc/sys/kernel/hostname.
but that won't be saved when you reboot.
--------------
MasterC never sleeps???
--------------
Thanks for covering me
And it would surely seem I don't, I know.
The cool part about it is that I actually have a full time job, take care of my house, have a decent social life and still have time to get at least 6 hours of sleep a day.
Here's the catch though:
I'm in the US Navy. I'm a pharmacy tech that works nights by myself, in a pharmacy in a small hospital, and lucky for me, rarely does anything happen. I get to spend nearly all 12 of my hours at work, on a T3 connection to LQ. Before I became a moderator I was known as an LQ Addict and the title was replaced but the spirit surely wasn't. In fact I spend more time here now than before
Does anyone know how to change the $HOSTNAME without a reboot? I thought restarting networking (/etc/init.d/networking) would do the trick, but it doesn't.
You will need to edit the /etc/hosts file on your other computers, unless you run a nameserver. In /etc/hosts, you have an entry for localhost which is accessed.
If you do change your computers hostname, you wil need to log out of KDE. Even if you edit a file, I think that you need to run the "hostname" command as well if you don't reboot. There are environment variables $HOST & $HOSTNAME that contain the hostname and may be used by some libraries.
Ok, currently my /etc/hostname shows the correct hostname. uname -a & cat /proc/sys/kernel/hostname does as well. However, cron jobs still email out w/ the incorrect hostname & when I first login via SSH that very first line also show the incorrect hostname. What did I miss, do I just have to reboot?
uid0sd@machine:~$ ssh correct_hostname
uid0sd@correct_hostname's password:
Linux previous_hostname 2.6.20-16-server #2 SMP Wed May 23 01:53:06 UTC 2007 i686
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
You have mail.
Last login: Tue Sep 11 07:53:25 2007 from machine.domain.com
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.