[kubuntu] How can I change the hostname for DHCP and make it has effect without restarting?

view story

http://ubuntuforums.org – I've already tried changing the hostname by editing both: /etc/hostname /etc/hosts However when I try to use sudo it doesn't work. I have to restart the computer to make sudo work again. The errors I get before restarting the computer are: Code: unable to resolve host <hostname> No protocol specified No protocol specified <application name>: cannot connect to X server :0 where <hostname> is the new name I changed and <application name> the name of the application I tried to run with sudo. I have also tried: sudo hostname <new hostname> bu (Hardware)