`$XAUTHORITY` appears from 'nowhere' on su+tmux
up vote
4
down vote
favorite
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.
shell login tmux variable su
add a comment |
up vote
4
down vote
favorite
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.
shell login tmux variable su
Could you be more specific about when you are executing what?
– gvkv
Sep 20 '10 at 20:42
It's too bad my theory didn't pan out but if you fix it, please post your solution.
– gvkv
Sep 22 '10 at 2:50
@Gilles: No. I didn't.
– Maciej Piechotka
Jan 18 '11 at 19:55
add a comment |
up vote
4
down vote
favorite
up vote
4
down vote
favorite
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.
shell login tmux variable su
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.
shell login tmux variable su
shell login tmux variable su
edited 2 days ago
Rui F Ribeiro
38.2k1475123
38.2k1475123
asked Sep 20 '10 at 13:13
Maciej Piechotka
11.1k64276
11.1k64276
Could you be more specific about when you are executing what?
– gvkv
Sep 20 '10 at 20:42
It's too bad my theory didn't pan out but if you fix it, please post your solution.
– gvkv
Sep 22 '10 at 2:50
@Gilles: No. I didn't.
– Maciej Piechotka
Jan 18 '11 at 19:55
add a comment |
Could you be more specific about when you are executing what?
– gvkv
Sep 20 '10 at 20:42
It's too bad my theory didn't pan out but if you fix it, please post your solution.
– gvkv
Sep 22 '10 at 2:50
@Gilles: No. I didn't.
– Maciej Piechotka
Jan 18 '11 at 19:55
Could you be more specific about when you are executing what?
– gvkv
Sep 20 '10 at 20:42
Could you be more specific about when you are executing what?
– gvkv
Sep 20 '10 at 20:42
It's too bad my theory didn't pan out but if you fix it, please post your solution.
– gvkv
Sep 22 '10 at 2:50
It's too bad my theory didn't pan out but if you fix it, please post your solution.
– gvkv
Sep 22 '10 at 2:50
@Gilles: No. I didn't.
– Maciej Piechotka
Jan 18 '11 at 19:55
@Gilles: No. I didn't.
– Maciej Piechotka
Jan 18 '11 at 19:55
add a comment |
3 Answers
3
active
oldest
votes
up vote
1
down vote
Here's what I think is happening.
When you're using su
and bash
, the su
-session inherits the environment with the exception of USER
, HOME
and SHELL
, thus XAUTHORITY
still points to ~username/.Xauthority
and everything is fine. However (from the man page), when the tmux
server is started:
... tmux copies the environment into the global
environment; in addition, each session has a session environment. When a
window is created, the session and global environments are merged with
the session environment overriding any variable present in both.
and I suspect (without knowing invocation details) that when you switch credentials, su
tries to find .Xauthority
in /root
and since it can't find one when you need to run an X
app, it creates one. I can think of a couple ways you can try to fix this:
- Invoke
su
by usingsu -
. This will copy over the real user's evironment - Add
set-environment <name> <value>
to yourtmux
config.
Unfortunately, I can't test this since I recently switched over to i3 (which is awesome) and I don't have a spare machine.
Except that I'm invoking su by su -. Alsoecho "$XAUTHORITY"
shows there is no~
. I'll tryset-enviroment
.
– Maciej Piechotka
Sep 20 '10 at 21:47
Actually I meant~
as a shorthand to (what I presumed) was your home directory. I've edited.
– gvkv
Sep 20 '10 at 23:26
1
no, i3 is i3, awesome is awesome =P .
– Kent Fredric
Feb 15 '11 at 9:40
add a comment |
up vote
0
down vote
This could be due to a misconfigured pam_xauth PAM module. It is supposed to copy your keys to a temporary file when you run su
. The behavior you describe is consistent with pam_xauth creating the temporary file but somehow not copying the keys (perhaps because you have a ~/.xauth/export
or a /root/.xauth/import
).
I don't have neither of those but xauth is loaded in su session (i.e. it is in /etc/pam.d/su).
– Maciej Piechotka
Nov 18 '10 at 0:19
add a comment |
up vote
0
down vote
It happened to me but this time with $COLORTERM variable.
If you start tmux on a terminal emulator that has, for instance, COLORTERM=terminus and after that you start another tmux session even on another terminal client that normally would have COLORTERM=gnome-terminal, this new session will crossover and inherit COLORTERM=terminus.
These assertions are enough to conclude that, unfortunately, tmux sessions are not isolated from each other, even if you're using different terminal emulators.
Your su sub shell is probably inheriting $XAUTHORITY from another tmux session, more specifically the very first tmux session created.
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Here's what I think is happening.
When you're using su
and bash
, the su
-session inherits the environment with the exception of USER
, HOME
and SHELL
, thus XAUTHORITY
still points to ~username/.Xauthority
and everything is fine. However (from the man page), when the tmux
server is started:
... tmux copies the environment into the global
environment; in addition, each session has a session environment. When a
window is created, the session and global environments are merged with
the session environment overriding any variable present in both.
and I suspect (without knowing invocation details) that when you switch credentials, su
tries to find .Xauthority
in /root
and since it can't find one when you need to run an X
app, it creates one. I can think of a couple ways you can try to fix this:
- Invoke
su
by usingsu -
. This will copy over the real user's evironment - Add
set-environment <name> <value>
to yourtmux
config.
Unfortunately, I can't test this since I recently switched over to i3 (which is awesome) and I don't have a spare machine.
Except that I'm invoking su by su -. Alsoecho "$XAUTHORITY"
shows there is no~
. I'll tryset-enviroment
.
– Maciej Piechotka
Sep 20 '10 at 21:47
Actually I meant~
as a shorthand to (what I presumed) was your home directory. I've edited.
– gvkv
Sep 20 '10 at 23:26
1
no, i3 is i3, awesome is awesome =P .
– Kent Fredric
Feb 15 '11 at 9:40
add a comment |
up vote
1
down vote
Here's what I think is happening.
When you're using su
and bash
, the su
-session inherits the environment with the exception of USER
, HOME
and SHELL
, thus XAUTHORITY
still points to ~username/.Xauthority
and everything is fine. However (from the man page), when the tmux
server is started:
... tmux copies the environment into the global
environment; in addition, each session has a session environment. When a
window is created, the session and global environments are merged with
the session environment overriding any variable present in both.
and I suspect (without knowing invocation details) that when you switch credentials, su
tries to find .Xauthority
in /root
and since it can't find one when you need to run an X
app, it creates one. I can think of a couple ways you can try to fix this:
- Invoke
su
by usingsu -
. This will copy over the real user's evironment - Add
set-environment <name> <value>
to yourtmux
config.
Unfortunately, I can't test this since I recently switched over to i3 (which is awesome) and I don't have a spare machine.
Except that I'm invoking su by su -. Alsoecho "$XAUTHORITY"
shows there is no~
. I'll tryset-enviroment
.
– Maciej Piechotka
Sep 20 '10 at 21:47
Actually I meant~
as a shorthand to (what I presumed) was your home directory. I've edited.
– gvkv
Sep 20 '10 at 23:26
1
no, i3 is i3, awesome is awesome =P .
– Kent Fredric
Feb 15 '11 at 9:40
add a comment |
up vote
1
down vote
up vote
1
down vote
Here's what I think is happening.
When you're using su
and bash
, the su
-session inherits the environment with the exception of USER
, HOME
and SHELL
, thus XAUTHORITY
still points to ~username/.Xauthority
and everything is fine. However (from the man page), when the tmux
server is started:
... tmux copies the environment into the global
environment; in addition, each session has a session environment. When a
window is created, the session and global environments are merged with
the session environment overriding any variable present in both.
and I suspect (without knowing invocation details) that when you switch credentials, su
tries to find .Xauthority
in /root
and since it can't find one when you need to run an X
app, it creates one. I can think of a couple ways you can try to fix this:
- Invoke
su
by usingsu -
. This will copy over the real user's evironment - Add
set-environment <name> <value>
to yourtmux
config.
Unfortunately, I can't test this since I recently switched over to i3 (which is awesome) and I don't have a spare machine.
Here's what I think is happening.
When you're using su
and bash
, the su
-session inherits the environment with the exception of USER
, HOME
and SHELL
, thus XAUTHORITY
still points to ~username/.Xauthority
and everything is fine. However (from the man page), when the tmux
server is started:
... tmux copies the environment into the global
environment; in addition, each session has a session environment. When a
window is created, the session and global environments are merged with
the session environment overriding any variable present in both.
and I suspect (without knowing invocation details) that when you switch credentials, su
tries to find .Xauthority
in /root
and since it can't find one when you need to run an X
app, it creates one. I can think of a couple ways you can try to fix this:
- Invoke
su
by usingsu -
. This will copy over the real user's evironment - Add
set-environment <name> <value>
to yourtmux
config.
Unfortunately, I can't test this since I recently switched over to i3 (which is awesome) and I don't have a spare machine.
edited Sep 20 '10 at 23:27
answered Sep 20 '10 at 21:42
gvkv
2,2851816
2,2851816
Except that I'm invoking su by su -. Alsoecho "$XAUTHORITY"
shows there is no~
. I'll tryset-enviroment
.
– Maciej Piechotka
Sep 20 '10 at 21:47
Actually I meant~
as a shorthand to (what I presumed) was your home directory. I've edited.
– gvkv
Sep 20 '10 at 23:26
1
no, i3 is i3, awesome is awesome =P .
– Kent Fredric
Feb 15 '11 at 9:40
add a comment |
Except that I'm invoking su by su -. Alsoecho "$XAUTHORITY"
shows there is no~
. I'll tryset-enviroment
.
– Maciej Piechotka
Sep 20 '10 at 21:47
Actually I meant~
as a shorthand to (what I presumed) was your home directory. I've edited.
– gvkv
Sep 20 '10 at 23:26
1
no, i3 is i3, awesome is awesome =P .
– Kent Fredric
Feb 15 '11 at 9:40
Except that I'm invoking su by su -. Also
echo "$XAUTHORITY"
shows there is no ~
. I'll try set-enviroment
.– Maciej Piechotka
Sep 20 '10 at 21:47
Except that I'm invoking su by su -. Also
echo "$XAUTHORITY"
shows there is no ~
. I'll try set-enviroment
.– Maciej Piechotka
Sep 20 '10 at 21:47
Actually I meant
~
as a shorthand to (what I presumed) was your home directory. I've edited.– gvkv
Sep 20 '10 at 23:26
Actually I meant
~
as a shorthand to (what I presumed) was your home directory. I've edited.– gvkv
Sep 20 '10 at 23:26
1
1
no, i3 is i3, awesome is awesome =P .
– Kent Fredric
Feb 15 '11 at 9:40
no, i3 is i3, awesome is awesome =P .
– Kent Fredric
Feb 15 '11 at 9:40
add a comment |
up vote
0
down vote
This could be due to a misconfigured pam_xauth PAM module. It is supposed to copy your keys to a temporary file when you run su
. The behavior you describe is consistent with pam_xauth creating the temporary file but somehow not copying the keys (perhaps because you have a ~/.xauth/export
or a /root/.xauth/import
).
I don't have neither of those but xauth is loaded in su session (i.e. it is in /etc/pam.d/su).
– Maciej Piechotka
Nov 18 '10 at 0:19
add a comment |
up vote
0
down vote
This could be due to a misconfigured pam_xauth PAM module. It is supposed to copy your keys to a temporary file when you run su
. The behavior you describe is consistent with pam_xauth creating the temporary file but somehow not copying the keys (perhaps because you have a ~/.xauth/export
or a /root/.xauth/import
).
I don't have neither of those but xauth is loaded in su session (i.e. it is in /etc/pam.d/su).
– Maciej Piechotka
Nov 18 '10 at 0:19
add a comment |
up vote
0
down vote
up vote
0
down vote
This could be due to a misconfigured pam_xauth PAM module. It is supposed to copy your keys to a temporary file when you run su
. The behavior you describe is consistent with pam_xauth creating the temporary file but somehow not copying the keys (perhaps because you have a ~/.xauth/export
or a /root/.xauth/import
).
This could be due to a misconfigured pam_xauth PAM module. It is supposed to copy your keys to a temporary file when you run su
. The behavior you describe is consistent with pam_xauth creating the temporary file but somehow not copying the keys (perhaps because you have a ~/.xauth/export
or a /root/.xauth/import
).
answered Nov 17 '10 at 23:06
Gilles
521k12610401570
521k12610401570
I don't have neither of those but xauth is loaded in su session (i.e. it is in /etc/pam.d/su).
– Maciej Piechotka
Nov 18 '10 at 0:19
add a comment |
I don't have neither of those but xauth is loaded in su session (i.e. it is in /etc/pam.d/su).
– Maciej Piechotka
Nov 18 '10 at 0:19
I don't have neither of those but xauth is loaded in su session (i.e. it is in /etc/pam.d/su).
– Maciej Piechotka
Nov 18 '10 at 0:19
I don't have neither of those but xauth is loaded in su session (i.e. it is in /etc/pam.d/su).
– Maciej Piechotka
Nov 18 '10 at 0:19
add a comment |
up vote
0
down vote
It happened to me but this time with $COLORTERM variable.
If you start tmux on a terminal emulator that has, for instance, COLORTERM=terminus and after that you start another tmux session even on another terminal client that normally would have COLORTERM=gnome-terminal, this new session will crossover and inherit COLORTERM=terminus.
These assertions are enough to conclude that, unfortunately, tmux sessions are not isolated from each other, even if you're using different terminal emulators.
Your su sub shell is probably inheriting $XAUTHORITY from another tmux session, more specifically the very first tmux session created.
add a comment |
up vote
0
down vote
It happened to me but this time with $COLORTERM variable.
If you start tmux on a terminal emulator that has, for instance, COLORTERM=terminus and after that you start another tmux session even on another terminal client that normally would have COLORTERM=gnome-terminal, this new session will crossover and inherit COLORTERM=terminus.
These assertions are enough to conclude that, unfortunately, tmux sessions are not isolated from each other, even if you're using different terminal emulators.
Your su sub shell is probably inheriting $XAUTHORITY from another tmux session, more specifically the very first tmux session created.
add a comment |
up vote
0
down vote
up vote
0
down vote
It happened to me but this time with $COLORTERM variable.
If you start tmux on a terminal emulator that has, for instance, COLORTERM=terminus and after that you start another tmux session even on another terminal client that normally would have COLORTERM=gnome-terminal, this new session will crossover and inherit COLORTERM=terminus.
These assertions are enough to conclude that, unfortunately, tmux sessions are not isolated from each other, even if you're using different terminal emulators.
Your su sub shell is probably inheriting $XAUTHORITY from another tmux session, more specifically the very first tmux session created.
It happened to me but this time with $COLORTERM variable.
If you start tmux on a terminal emulator that has, for instance, COLORTERM=terminus and after that you start another tmux session even on another terminal client that normally would have COLORTERM=gnome-terminal, this new session will crossover and inherit COLORTERM=terminus.
These assertions are enough to conclude that, unfortunately, tmux sessions are not isolated from each other, even if you're using different terminal emulators.
Your su sub shell is probably inheriting $XAUTHORITY from another tmux session, more specifically the very first tmux session created.
answered May 5 '14 at 7:59
marcio
188117
188117
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f2269%2fxauthority-appears-from-nowhere-on-sutmux%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Could you be more specific about when you are executing what?
– gvkv
Sep 20 '10 at 20:42
It's too bad my theory didn't pan out but if you fix it, please post your solution.
– gvkv
Sep 22 '10 at 2:50
@Gilles: No. I didn't.
– Maciej Piechotka
Jan 18 '11 at 19:55