This question already has an answer here:
When I connect to my server (ubuntu server 10.10), I get this:
name@server-name.belkin ~>
How can I remove ".belkin"?
|
This question already has an answer here: When I connect to my server (ubuntu server 10.10), I get this:
How can I remove ".belkin"? |
|||||||||||||||||
marked as duplicate by Eliah Kagan, muru, Eric Carvalho, TheWanderer, David Foerster Feb 1 '17 at 11:43This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. |
|||||||||||||||||
|
|||||||||||||||||
|
You need to edit the computer name in two files:
and
These will both need administrative access, so run
Replace any instances of the existing computer name with your new one. When complete run
The name will also be changed if you restart your computer. See also: |
|||||||||||||||||||||
|
|
hostnamectl is the best way if you have systemd (13.10 onwards):
It:
More info at: https://askubuntu.com/a/516898/52975 |
|||||||||||||||||||||
|
|
It's quite easy:
As long as you have no application settings depending on the 'old' hostname, you should be ok ;-) |
|||||||||||||||||||||
|
|
It is safe to do, you just need to be sure you edit both the system hostname configuration file (/etc/hostname) and the hostname name resolution file (/etc/hosts). From a terminal execute the following:
|
|||||||||
|
|
In addition to editing /etc/hosts and /etc/hostname, various services might have issues with the change as well. Mysql and postfix are installed by default in ubuntu. A broken postfix won't affect most ubuntu users, since it's a background email server that isn't used by much. Postfix:
The default config for mysql doesn't use hostname, so it will work fine as-is. If you have customized it, edit the files in /etc/mysql/ and restart the service. You may also want to edit /etc/motd (message of the day), which is shown on virtual terminals and remote logins. That one won't harm anything though. Other services that you may have installed that would need fixing are apache, bind9, etc. In each case, find and edit the hostname in their config and restart the service. |
||||
|
|
Another better and safe way to rename hostnameInstall ailurus
|
|||||||||||||||||||||
|
|
The host name uniquely identifies your computer on the local network (and possibly on the Internet as well) so it's not a good idea to change it unless you know what you are doing. But you can change the shell prompt not to display the
See the bash man page and specifically the section on prompting for more information. |
|||
|
|
|
Use the
However, this does not edit your hosts file, which you must do so as to make sure that your computer recognizes itself
And add a new entry for your hostname pointing to 127.0.0.1
You could remove the old entry as well, but I prefer to keep it there. |
||||
|
|
|
If you don't want to play with a text editor, Ubuntu Tweak (grab the deb from their website) has that as one of the little things you can play with (along with lots of other little tweaks that you might want to make but don't really want to play around with the terminal and the files themselves). |
|||||||||||||||||
|
|
The following command change the hostname on the fly but to make it permanent, you have to edit
Open a new terminal session and you'll see it right away. With
|
||||
|
|
|
If you want a GUI assisted process install Ubuntu-Tweak. Among other uses of this app is the ability to change computer name through tab "Computer-Details" -> "Hostname" |
|||
|
|
|
SystemSettings -> Details -> Overwiev (default opened in U16.04) - Device Name. but additionally you must change name in /etc/hosts. Ubuntu BUG()? |
|||||
|
|
Open a terminal and
|
|||
|
|
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?