I have recently installed Fedora 30 on a new laptop. When I had set it up, my hostname, as seen in the command prompt, was set to simply 'fedora'. At some point during the last month of usage the hostname changed to 'Galaxy-Note9'. I have no idea precisely how this happened, although this is the model of my phone, so I guess something weird went on when I plugged my phone in at some point. I researched how to change the name of my computer to fix this issue. Everything I found pertained to changing the hostname, so I did this using the hostnamectl command and reset it to 'fedora'. This change persisted reboot and successfully changed the name in the prompt and as returned by the hostname command, so I considered the matter solved.

However, today I have been SSHing into my raspberry pi, and I noticed that the second time I accessed it, it said that the last login was from a device named 'galaxy-note9.home'. Indeed, I checked the devices on my network with nmap -sP 192.168.1.* and the IP address of my laptop was listed under the name 'Galaxy-Note9.home'. My hostname is still set to 'fedora'.

How can I fully change the name of my system so this won't crop up again here or anywhere else in future? And can anybody explain why the name changed in the first place?


1 - Set correct host name to appear inside the computer:

The computer name is set in the file /etc/hostname. If you edit this then you ought to get your computer name back.

If this does not work:

Please check the /etc/hosts file and add your desired hostname to the IP address, like so: fedora

If this still does not work:

Some computers may also set the computer / host name by DHCP which means that it can change dynamically as instructed by your home router. Perhaps this has happened?

2 - Display correct host name from the outside:

If the host name is correct inside the computer and never appears wrong from the inside then your DNS server (home router, I guess?) might be assigning different IP addresses to your computers when they re-connect at a later time.

Most home routers / DSL/cable modems can be configured by setting an option

[X] Always assign the same IP address to this device

by its web interface, for each computer, as in the documentation for this particular device:

Configuring FRITZ!Box to always assign the same IP address to a network device

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.