X11 Forwarding for Desktop over SSH
Type the command below, which will activate xinit in virtual terminal 8. Note that you will be automatically switched to virtual terminal 8. You can switch back to the original virtual terminal 7 by pressing Ctrl+Alt+F7.
# xinit -- :1 &
After switching to virtual terminal 8, execute the following command to launch the RPi desktop remotely. Type pi user password when asked (see picture below).
# DISPLAY=:1 ssh -X pi@192.168.2.5 lxsession
You will bring to your new virtual terminal 8 the remote RPi desktop, as well as a small terminal launched from your active virtual terminal 7 (see picture below).
Remember, do not close that terminal. Otherwise, your RPi desktop will close immediately.
You can move between first and second virtual terminals by pressing Ctrl+Alt+F7 or Ctrl+Alt+F8.
https://www.xmodulo.com/remote-control-raspberry-pi.html
virtual terminal 7 - vt7
root@slitaz:~# xinit -- :1 &
root@slitaz:~#
X.Org X Server 1.19.3
Release Date: 2017-03-15
X Protocol Version 11, Revision 0
Build Operating System: SliTaz GNU/Linux
Current Operating System: Linux slitaz 5.4.41-slitaz #1 SMP Sat Aug 29 08:07:49 CST 2020 x86_64
Kernel command line: BOOT_IMAGE=/efi/boot/vmlinuz-5.4.41-slitaz root=/dev/null autologin
Build Date: 15 March 2018 04:57:16PM
Current version of pixman: 0.34.0
Before reporting problems, check http://www.slitaz.org/
to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.1.log", Time: Sat Sep 4 11:54:59 2021
(==) Using config directory: "/etc/X11/xorg.conf.d"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
root@slitaz:~# ps ax | grep -B 1 -A 5 Xorg
2636 ? Ss 0:00 /usr/bin/slim -d
2642 tty7 Ssl+ 1:09 /usr/libexec/Xorg -auth /var/run/slim.auth vt07
2657 ? Sl 0:04 /usr/bin/openbox --startup /usr/lib/openbox/openbox-autostart OPENBOX
2695 ? S 0:00 dbus-launch --sh-syntax --exit-with-session openbox-session
2696 ? Ss 0:00 /usr/bin/dbus-daemon --fork --print-pid 6 --print-address 8 --session
2709 ? Sl 0:00 /usr/libexec/gvfsd
2714 ? Sl 0:00 /usr/libexec/gvfsd-fuse /home/tux/.gvfs -f -o big_writes
--
4364 pts/0 S 0:00 xinit -- :1
4366 tty8 S<sl+ 0:00 /usr/libexec/Xorg :1
4380 pts/0 S 0:00 xterm -geometry +1+1 -n login
4381 pts/1 Ss 0:00 sh
4383 ? I 0:00 [kworker/3:2-events]
4384 pts/1 S+ 0:01 ssh -Y tux@192.168.0.192 openbox-session
4389 ? I 0:00 [kworker/4:0-events]
4396 pts/0 R+ 0:00 ps ax
4398 pts/0 S+ 0:00 grep -B 1 -A 5 Xorg
root@slitaz:~#
virtual terminal 8 - vt8
login - xterm
root@slitaz:~# DISPLAY=:1 ssh -Y tux@192.168.0.192 openbox-session
Secure login on SliTaz GNU/Linux powered by Dropbear SSH server.
tux@192.168.0.192's password:
Warning: No xauth data; using fake authentication data for X11 forwarding.
Obt-Message: Failed to open an Input Method
DBUS_SESSION_BUS_ADDRESS='unix:abstract=/tmp/dbus-AbPhdIjHlc,guid=b322887fba9877e40478d99861333d77';
export DBUS_SESSION_BUS_ADDRESS;
DBUS_SESSION_BUS_PID=6567;
DBUS_SESSION_BUS_WINDOWID=8388609;
(pcmanfm:6548): GLib-CRITICAL **: g_file_test: assertion 'filename != NULL' failed
(pcmanfm:6548): GLib-CRITICAL **: g_file_test: assertion 'filename != NULL' failed
(pcmanfm:6548): GLib-CRITICAL **: g_file_test: assertion 'filename != NULL' failed
SliTaz x86_64 - sakura
~ $ lxpanel -p slitaz &
~ $
(lxpanel:6669): Wnck-WARNING **: Unhandled action type _OB_WM_ACTION_UNDECORATE
(lxpanel:6669): Wnck-WARNING **: Unhandled action type _OB_WM_ACTION_UNDECORATE
~ $ echo $DISPLAY
localhost:10.0
~ $ env | egrep 'SSH|DIS'
SSH_CLIENT=192.168.0.191 59020 22
DISPLAY=localhost:10.0
SSH_CONNECTION=192.168.0.191 59020 192.168.0.192 22
~ $