PDA

View Full Version : Change Host name on Linux SSH Console...



hamstar
30-01-2004, 12:40 AM
Short and sweet...

How do you change your host name in a ssh linux console?

Cheers

Chilling_Silently
30-01-2004, 02:39 AM
You mean the PC's hostname?

Edit /etc/hostname
Use vim, nano, jed, whatever takes your fancy :-)


Chill.

Graham L
30-01-2004, 03:46 PM
Or use the hostname command?

cyberchuck
31-01-2004, 06:38 PM
> Or use the hostname command?

I thought that was only a temporary fix for the problem - it worked but it was lost on rebooting the machine?

bmason
31-01-2004, 07:41 PM
The hostname command sets it in the currently running kernel (it just sets /proc/sys/kernel/hostname). The change is reset when you reboot.

Edit the file /etc/hostname (/etc/sysconfig/hostname on mandrake) to make a permanent change, but it won't take effect until you reboot or use the hostname command.

There are also curses based programs that will do both, eg "netconf" without really having to use the commandline.