Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent $DISPLAY from being overridden in SSH (for X11 forwarding) #216

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

InnovativeInventor
Copy link

When trying to ssh into a qubes vm, /etc/profile.d/qubes-gui.sh will improperly set $DISPLAY to be :0. When X11 forwarding is used, $DISPLAY is automatically set to ensure that the relevant windows get forwarded to the ssh client. However, since qubes-gui.sh is called after a successful login, the correct value for $DISPLAY will be overridden.

This commit fixes the issue by adding a test in qubes-gui.sh to check if we are currently in an ssh session (by checking if $SSH_CLIENT or $SSH_TTY are set).

Note: I do not know .csh scripts and have not tested the proposed change to qubes-gui.csh, yet.

When trying to ssh into a qubes vm, `/etc/profile.d/qubes-gui.sh` will
improperly set `$DISPLAY` to be :0. When X11 forwarding is used, `$DISPLAY`
is automatically set to ensure that the relevant windows get forwarded
to the ssh client. However, since qubes-gui.sh is called after a
successful login, the correct value for `$DISPLAY` will be overridden.

This commit fixes the issue by adding a test in qubes-gui.sh to check if
we are currently in an ssh session (by checking if `$SSH_CLIENT` or
`$SSH_TTY` are set).

Note: I do not know .csh scripts and have not tested the proposed change
to qubes-gui.csh, yet.
Comment on lines +1 to +3
if ! ([ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] ]); then
export DISPLAY=:0 _JAVA_AWT_WM_NONREPARENTING=1
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First, this should apply only to DISPLAY, not the other variable.
But second, having it specifically for SSH isn't very elegant. Maybe better simply check if it's set already and not override it then? This can be done simpler:

: ${DISPLAY:=:0}
export DISPLAY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants