I have (tigerVNC) vncserver setup correctly on the new installed Ubuntu 24.04.1 and also tried the ubuntu 24.04 default remote login feature. Both feature doesn't keep the desktop section after restart.
I use the below xstartup file under .vnc folder to properly initialize the vncserver with xfce4.
env -i /bin/sh -c "export PATH=$PATH;
export XAUTHORITY=$XAUTHORITY;
export DISPLAY=$DISPLAY;
export HOME=$HOME;
export LOGNAME=$LOGNAME;
export USER=$USER;
/usr/bin/xfce4-session"
The strange thing is that I can only successfully start the vncserver after I login in front of the PC. Any attempt to start the vncserver via ssh or boot startup failed.
Through ssh I can boot with tigervncserver -xstartup /usr/bin/xterm, but I cannot get the xfce4 or the default Gnome desktop to work.
I do have access to the rdp desktop via default remote sharing feature (not install xrdp). However, Whenever I login remotely (not within the same intranet or wifi network but through vpn or gateway route mapping), I cannot login successfully to the rdp desktop. I have tried ssh -X and also using a openVPN connected to that network. No way works so far. It's either failed to connected immediately.
Any suggestions that can help solve the problem will be appreciated. Either it's about vncserver ssh/boot start up for Xfce or rdp setup that I can access the desktop remotely after ubuntu server reboot. As the server restart do happened sometimes.
The way I proposed in the answer below suffer from another issue as others mentioned: RDP doesn't keep sessions alive in Ubuntu 24.04 after disconnecting How to disable logoff on session disconnect in Ubuntu native RDP
In a nutshell, when I close the RDP connection, the ubuntu server will log off the user and hence the next time when I log in to ubuntu via RDP again, it's a new session but not the previous section.
I tried to bypass this issue by sharing screen, which means I physically log in the account in front of the laptop and keep the machine running. However, I find I am not able to access the desktop sharing when I am not within the intranet of the ubuntu server. However, remote login works in such setup. But remote login will reset everything after I close the RDP client window which is not desired.
So I am still suffering from a proper way to working with ubuntu 24.04 remotely. I am looking forward to any suggestions.
Besides that, vncserver suffser from significant delay when connecting using openVPN tunnel, I would prefer the remote login feature to work.
