How To Setup VNC, XRDP, XDoTool on Ubuntu (Azure, Gcloud)
# update
sudo apt update -y
# install xdotool
sudo apt install xdotool -y
# prepare xfce desktop env
sudo apt install xfce4 xfce4-goodies -y
# vnc4server causes segmentation fault with xdotool so we will be using xrdp + vnc
sudo apt install vnc4server xrdp -y
# enable xrdp
sudo systemctl enable xrdp
# add ssl user
sudo adduser xrdp ssl-cert
# add startxfce4 to the startup
echo ""exec startxfce4"" | sudo tee -a /etc/xrdp/xrdp.ini
# restart xrdp
sudo systemctl restart xrdp
# if you are using REMMINA and your remote desktop server is xrdp you need to check
# "Relax Order Checks" on the Advanced Tab in the profile
# disable extra security
sudo apt install selinux-utils -y
setenforce 0
# start a big screen session
vncserver -geometry 1920x1080
# and kill it
vncserver -kill :1
# reload daemons
sudo systemctl daemon-reload
# enable vncserver
sudo systemctl enable --now vncserver@1
# open the xrdp port and the vnc port
sudo ufw allow 5901
sudo ufw allow 3389
# if you are using RHEL/CENTOS
# sudo firewall-cmd --permanent –add-port=5901/tcp
# sudo firewall-cmd --permanent –add-port=3389/tcp
# sudo firewall-cmd –reload
# open some applicationsa
export DISPLAY=:1
xfwm4 &
xfce4-panel &
xdotool getmouselocation