3

When I installed Ubuntu I named my computer "test"

after the installation was finished, I renamed the hostname to somewhat nicer:

sudo hostname silversurfer

And I added the hostname to /etc/hosts

But still even after a reboot, in syslog all messages are preceeded by "test":

tail -f /var/log/syslog
Feb 24 04:51:28 test ntpd[4598]: peers refreshed
Feb 24 04:51:28 test ntpd[4598]: Listening on routing socket on fd #24 for interface updates
...

My /etc/hosts/ looks like this:

127.0.0.1   localhost
127.0.1.1   test silversurfer

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
rubo77
  • 32,486

2 Answers2

3

I found out:

the first hostname for 127.0.1.1 in /etc/hosts is mentioned in syslog, so you have to change:

127.0.0.1   localhost
127.0.1.1   silversurfer test

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
...
rubo77
  • 32,486
1

To change the hostname Permanently Edit the file /etc/hosts

# vi /etc/hosts

127.0.0.1       localhost
192.168.1.100    sambafileserver    samba

Setting up Hostname in /etc/hostname file

# echo "Your Hostname Herer" > /etc/hostname
# hostname -F /etc/hostname

Example:

# echo "sambafileserver" > /etc/hostname
# hostname -F /etc/hostname

Then Restart the Desktop or Server.

Logs file which Created Before hostname change will be in test.