Robert Nichols
2015-Apr-26 23:26 UTC
[CentOS] Prevent network setup from changing the hostname
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 -". -- Bob Nichols "NOSPAM" is really part of my email address. Do NOT delete it.
Peter Larsen
2015-Apr-26 23:31 UTC
[CentOS] Prevent network setup from changing the hostname
Make it a system connection instead of a user connection. Or give the host a static name on install and don't allow dhcp to override it. On 04/26/2015 07:26 PM, Robert Nichols wrote:> 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 -". >-- Regards Peter Larsen
Robert Nichols
2015-Apr-27 00:25 UTC
[CentOS] Prevent network setup from changing the hostname
On 04/26/2015 06:31 PM, Peter Larsen wrote:> On 04/26/2015 07:26 PM, Robert Nichols wrote: >> How can I block network setup (via NetworkManager) from changing >> the machine's hostname whenever the network configuration changes? > > Make it a system connection instead of a user connection. Or give the > host a static name on install and don't allow dhcp to override it.Making my wireless connection a system connection increases the exposure of my WPA key and doesn't solve the problem of the network configuration changing, perhaps because I connected or disconnected an ethernet cable or the machine went to sleep on one WLAN and woke up on another. Do you know of a place I can set a static name that NetworkManager won't override? That would be ideal. I just doesn't make sense that the machine's internal relationships would depend on its external connections. -- Bob Nichols "NOSPAM" is really part of my email address. Do NOT delete it.