When I switched from su+bash to su+tmux+zsh I noticed that I get $XAUTHORITY variable defined as /root/.xauthXXXXXX where XXXXXX are 6 random alphanumeric characters. With previous configuration X worked with root flowlessly but now I need to copy ~username/.Xauthority to $XAUTHORITY.Variable is nowhere defined (I checked .zshrc, /etc/profile*, /etc/profile.d/* etc.).# envTERM=screenSHELL=/usr/bin/tmuxUSER=toorTMUX=/tmp//tmux-0/default,6495,3PATH=/sbin:/bin:/usr/sbin:/usr/binPWD=/rootSHLVL=2HOME=/rootLOGNAME=toorDISPLAY=:0.0XAUTHORITY=/root/.xauthUSzLl4COLORTERM=gnome-terminal_=/bin/envOLDPWD=/rootEDITOR=vimvcs_info_msg_0_=vcs_info_msg_1_=Edit:% echo $XAUTHORITY /home/mpiechotka/.Xauthority% su password:# echo $XAUTHORITY /root/.xauthUSzLl4# ls $XAUTHORITYls: cannot access /root/.xauthUSzLl4: No such file or directory# cat .tmux.conf set -g default-command /bin/zshset -g default-shell /bin/zshsu is aliased to su - toor and it opens tmux as shell. toor is an alias of root with different shell.PS. I just discovered that it appears on normal su as well. It did not some time ago...Edit 2 set-enviroment didn't help eitherEdit 3 xhost +localhost did not helped but xhost + (disabling all control) DID helped.
`$XAUTHORITY` appears from 'nowhere' on su+tmux
shell;login;su;tmux