logout from remote desktop

If we connect to dietpi via Remote Desktop, in lxde (I think the most used because of lightness) logout button have too many options; suspend, hibernate and lockscreen I think are useless, also if you logon via root there is the risk of shutdown the server that is located km / miles away.

In lxde when you press close session in lxde-menu from lxde-panel it launch /usr/bin/lxde-logout:

#!/bin/sh

lxsession-logout --banner "/usr/share/lxde/images/logout-banner.png" --side=top

I can’t code, so I used zenity

apt-get install zenity

edited /usr/bin/lxde-logout

#!/bin/sh

#lxsession-logout --banner "/usr/share/lxde/images/logout-banner.png" --side=top

zenity --icon-name="system-log-out" --question --title="Logout" --text="Are you sure?"
if [ $? = 0 ]; then
    pkill -SIGTERM -f lxsession
else
    exit
fi

And simply logout.

https://github.com/lxde/lxsession/tree/master/lxsession-logout can be edited removing suspend, hibernate, lockscreen and why not, with dietpi banner. In next days I’ll do some experiments with it.

To stop/exit vnc desktop session I recommend:

systemctl stop vncserver

Terminates desktop, session, vnc server and everything related.

Then to restart:

systemctl start vncserver