[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

WORKAROUND Re: Cannot change hostname permanently

Liam O'Toole wrote:
The output you quote above is the result of init invoking

    /etc/init.d/hostname.sh start

What happens when you do this manually?
   # hostname desktop
   # hostname

   # /etc/init.d/hostname.sh
   Setting hostname to 'earth'...done.

Are there any weird permissions
on the file /etc/hostname?

# ls -l /etc/hostname
-rw-r--r-- 1 root root 6 2006-06-14 16:26 /etc/hostname

It seems that the hostname command does not actually modify the /etc/hostname file, yet the hostname command does report the new name.

   # hostname desktop

   # cat /etc/hostname

   # hostname

Perhaps hostname is reading from /proc rather than /etc/hostname?

A workaround is to change the hostname by editing /etc/hostname directly.

   # echo desktop > /etc/hostname


Reply to: