When I switched from su+bash
to su+tmux+zsh
I noticed that I get the $XAUTHORITY
variable defined as /root/.xauthXXXXXX
where XXXXXX
are 6 random alphanumeric characters. With the previous configuration, X worked with root flawlessly, but now I need to copy ~username/.Xauthority
to $XAUTHORITY
.
The variable is defined nowhere; I checked .zshrc
, /etc/profile*
, /etc/profile.d/*
etc.
# env
TERM=screen
SHELL=/usr/bin/tmux
USER=toor
TMUX=/tmp//tmux-0/default,6495,3
PATH=/sbin:/bin:/usr/sbin:/usr/bin
PWD=/root
SHLVL=2
HOME=/root
LOGNAME=toor
DISPLAY=:0.0
XAUTHORITY=/root/.xauthUSzLl4
COLORTERM=gnome-terminal
_=/bin/env
OLDPWD=/root
EDITOR=vim
vcs_info_msg_0_=
vcs_info_msg_1_=
% echo $XAUTHORITY
/home/mpiechotka/.Xauthority
% su
password:
# echo $XAUTHORITY
/root/.xauthUSzLl4
# ls $XAUTHORITY
ls: cannot access /root/.xauthUSzLl4: No such file or directory
# cat .tmux.conf
set -g default-command /bin/zsh
set -g default-shell /bin/zsh
su
is aliased to su - toor
and it opens tmux
as shell. toor is an alias of root with different shell.
I just discovered that it appears on normal su as well. It did not do that some time ago.
set-environment
did not work.
xhost +localhost
did not work, but xhost +
(disabling all control) DID work.