How can I block network setup (via NetworkManager) from changing the machine’s hostname whenever the network configuration changes?
The problem: When my graphical login session starts, the xauth database gets an token that is labeled with the hostname at that time. If there is not yet a network connection, that will be
“localhost.localdomain”. When a network connection is then made
(my wireless connection needs the key from my login), the hostname changes. That breaks X session sharing because there is no xauth token that matches the current hostname. If I get a root shell with “su -“, commands launched from that shell cannot access the display. If I set up an SSH connection with “ssh -X”, I get a complaint about missing xauth data.
On systems with an “ONBOOT=yes” network connection, there is no problem since the hostname is set before the X session starts. It’s just when the hostname changes during the X session that there is a problem.
I am running CentOS 6, fully updated. It’s taken me a long time to track down the root cause of this problem. Now I just need a solution, preferably something less ham-fisted than “xhost -“.