my system (fedora 40) automatically shows user@dhcpf196 instead of the usual user@fedora in the terminal whenever I connect to the internet. I think this is my university dhcp server but the machine I'm using is personal and I don't want it to automatically connect to that. How do I fix this? Also in "Devices and Locations", under "This Device" I have my home folder as expected and then a disk named dhcpf196.fit.vutbr.cz (my uni server) which goes back to being called fedora when I disconnect.
1 Answer
The part after @
in your shell prompt is the system hostname (i.e. your own computer's name as set through "Settings > About"). The DHCP server is probably set up to provide a new hostname as part of the DHCP lease, and some systems do honor it (it's a common problem with macOS as well).
Fedora usually uses NetworkManager for DHCP; you can disable its use of DHCP-provided hostnames in two ways:
Separately for each connection:
Run
nmcli con
to find the connection profile name, then disable the feature using:nmcli con modify "name" hostname.from-dhcp false nmcli con modify "name" hostname.from-dns-lookup false
Globally:
Edit
/etc/NetworkManager/NetworkManager.conf
, adding the following setting:[main] hostname-mode=none
In your case, it's possible that the system uses the DHCP-provided hostname because you haven't set one yourself (i.e. you're still using the default fedora
hostname), so you should change that.