View Full Version : [ubuntu] Changing hostname permanently
sefa
July 23rd, 2010, 07:31 PM
Hi,
I am new to Ubuntu 10.04 and so far I love it!!! I recently created a LiveUSB and I am running Ubuntu from my USB drive with preserve mode.
I changed the /etc/hostname and /etc/hosts files with my new hostname and everytime I reboot those files are going back to original state and change the hostname back to ubuntu...
The rest of my installed applications and settings are preserved... Is there a way to permanently change the host name?
Thanks,
Sefa
endotherm
July 23rd, 2010, 07:34 PM
try
sudo hostname <newhostname>
and let us know if that works. I had been about to tell you to edit /etc/hostname and reboot, but it seems youve tried that
sefa
July 24th, 2010, 02:20 AM
Hi,
I tried
sudo hostname server1
after the reboot the hostname is reverted back to ubuntu... Any ideas?
Thanks,
Sefa
wojox
July 24th, 2010, 02:23 AM
You need to edit two files with root privileges.
gksudo gedit /etc/hosts
gksudo gedit /etc/hostname
sefa
July 24th, 2010, 02:46 AM
I did try to edit those two files with root privileges. Any ideas? Have anyone run into the same issue?
wojox
July 24th, 2010, 10:03 PM
I did try to edit those two files with root privileges. Any ideas? Have anyone run into the same issue?
Edit those two files changing only the hostname and reboot.
doublewitt
August 1st, 2010, 02:11 AM
You need to edit two files with root privileges.
gksudo gedit /etc/hosts
gksudo gedit /etc/hostname
This fixed it for me - thanks...!
efflandt
August 1st, 2010, 09:59 AM
For a live/install iso the system boots before persistent data is mounted, so you might need to copy those /etc/hostname and /etc/hosts to the home directory of the default ubuntu user, edit how you want them, then add these lines to .profile of ubuntu user:
sudo cp /home/ubuntu/hostname /etc/hostname
sudo cp /home/ubuntu/hosts /etc/hosts
Note that files that begin with dot are normally hidden, but you can see them in File Browser by hitting Ctrl+H, or with ls -a in terminal.
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.