The 2 commands below will open an X remote session in a window (one could also do it in a fullscreen desktop page or in another tty, but that’s not the problem):
Xephyr -fp $DEFAULT_FONT_PATH -ac -mouse ephyr -keybd ephyr -screen $res -dpi $DPI -br -noreset :$Screen &
**DISPLAY=$(hostname -f):${Screen}.0** ssh -Y $USER@$server Xres="$res" $Xsession $WM
Xephyr -fp $DEFAULT_FONT_PATH **-ac** -mouse ephyr -keybd ephyr -screen $res -dpi $DPI -br -reset -terminate :$Screen &
ssh -Y $USER@$server **DISPLAY=$(hostname -f):${Screen}.0** Xres="$res" $Xsession $WM
Where
- $Screen is the next available (= unlocked) screen on the ssh client (the Xephyr server)
- $Xsession the script which starts the desktop session on the ssh server. such as /etc/X11/xdm/Xsession for example, but mine looks different.
- $WM the window manager which should be started and is passed as argument to $Xsession
- The other variables are not that relevant
- The ssh client (where these code is executed) is called ‘neelix’. The server is called ‘arpad’.
However:
With code 1:
DISPLAY is on the SSH server (arpad).
echo $DISPLAY
localhost:10.0
but if I set X11UseLocalhost to no in /etc/ssh/sshd_config (the default is yes), I get:
echo $DISPLAY
arpad:11.0
Btw the screen number (started at the value specified in X11DisplayOffset in sshd_config) is not reset and get incremented every time (?).
With code 2:
DISPLAY is on the SSH client (neelix)
echo $DISPLAY
neelix.niglo.net:1.0
With code 1:
ssh prints a warning:
Warning: No xauth data; using fake authentication data for X11 forwarding.
I can get rid on this warning by sending a MIT-MAGIC-COOKIE to the ssh server … however the DISPLAY names don’t match (?)
- If “1” is the next unlocked screen on neelix, cookie sent/received will be for neelix.niglo.net:1 and DISPLAY is either local:10.0 or arpad:10.0 (depending on sshd settings mentioned above).
With code 2:
ssh prints a warning:
Warning: No xauth data; using fake authentication data for X11 forwarding.
I can NOT get rid on this warning by sending a MIT-MAGIC-COOKIE to the ssh server … however the DISPLAY names match (?)
- If “1” is the next unlocked screen on neelix, cookie sent/received will be for neelix.niglo.net:1 and DISPLAY is neelix.niglo.net:1.0
code 1:
always works.
code 2:
rarely works the first time and needs several attempts to finally open the DISPLAY. (?)
I don’t know which code to use. Code 1 seems safer, but I prefer code2. I would like to know:
- why code 2 doesn’t work every time.
- why does ssh complain when the MIT-MAGIC-COOKIE matches the DISPLAY and not when cookie and DISPLAY don’t match.
- why code 2 never works if Idon’t disable access control restriction (option -ac in Xephyr - in red in the example code). Code 1 woks with or without -ac.