# ideally these are all done in a screen/tmux session
sudo su
apt-get update ; apt-get install -y xserver-xorg-video-dummy
# let's create a fake / virtual display device
echo 'Section "Device"' > /etc/X11/xorg.conf
echo ' Identifier "Configured Video Device"' >> /etc/X11/xorg.conf
echo ' Driver "dummy"' >> /etc/X11/xorg.conf
echo 'EndSection' >> /etc/X11/xorg.conf
echo '' >> /etc/X11/xorg.conf
echo 'Section "Monitor"' >> /etc/X11/xorg.conf
echo ' Identifier "Configured Monitor"' >> /etc/X11/xorg.conf
echo ' HorizSync 31.5-48.5' >> /etc/X11/xorg.conf
echo ' VertRefresh 50-70' >> /etc/X11/xorg.conf
echo 'EndSection' >> /etc/X11/xorg.conf
echo '' >> /etc/X11/xorg.conf
echo 'Section "Screen"' >> /etc/X11/xorg.conf
echo ' Identifier "Default Screen"' >> /etc/X11/xorg.conf
echo ' Monitor "Configured Monitor"' >> /etc/X11/xorg.conf
echo ' Device "Configured Video Device"' >> /etc/X11/xorg.conf
echo ' DefaultDepth 24' >> /etc/X11/xorg.conf
echo ' SubSection "Display"' >> /etc/X11/xorg.conf
echo ' Depth 24' >> /etc/X11/xorg.conf
echo ' Modes "1024x800"' >> /etc/X11/xorg.conf
echo ' EndSubSection' >> /etc/X11/xorg.conf
echo 'EndSection' >> /etc/X11/xorg.conf
shutdown -r now
# start GUI
startx
# open another screen/tmux
# install xrdp
# so we can remote screen to X / desktop
apt-get install xrdp
adduser xrdp ssl-cert
nano /etc/xrdp/xrdp.ini
# make sure there's this line to ensure secure access to xrdp
# (forcing xrdp to listen to 127.0.0.1 port 3389)
# port=tcp://.:3389
systemctl restart xrdp
##########
# Then you can connect to the GUI by creating an SSH Tunnel to 127.0.0.1 port 3389 on server
#ssh -v -L 3389:localhost:33890 -N [email protected]
# then connect to port 33890 - voila, server's GUI
#rdesktop localhost:33890
Comments