Autologon to desktop as user


I had problems with armbian and unofficial jessie images for my Odroid-C2, so I want to try out dietpc.
Everything good so far and easy to setup except that I need to get the odroid to logon to desktop automatically at startup AS USER NOT ROOT.
How do I do that?


Which desktop are you using, and whats the user name?

the user is “odroid” and the desktop environment is lxde


desperately need this
diet-config autologin option should ask for the non-root user login
and its not great to run Desktop as root

sorry for resurrecting this old thread

Do you have this file?


If so, you should find the following iine:


Remove the # and change it to have your username at the end. As an example:


If you don’t have that file… sorry, I have no idea.


We are looking to replace root user with non-root user throughout DietPi. This would resolve this thread, please see here for status:

Hi folks. So I am following development of this upcoming change however Im wondering if there’s a fix in the short-term that will work for me. :slight_smile: I have several apps (VLC/Chromium) I use that complain about being run as root. :frowning:

What mechanism is “DietPi-AutoStart/2 Desktops: Automatic login (recommended)” using to login root and start X? (file/s to edit?)

Thanx! :slight_smile:


Try, editing:


And replace the following entry for startx:

                       #Desktop (LXDE/MATE etc)
                        elif (( $AUTO_START_INDEX == 2 )); then

                               sudo -u dietpi startx

Reboot and test.

I’ve tested this method on my odroid c2 with LXDE
Not working for me, I’m getting Xorg error, permission denied and connection refused, maybe I have to add my user to the sudoers list. Will report on this when I have tested.

I did manage to autologin into my normal unprivileged user by selecting login into lightdm in dietpi-config and adding


to /etc/lightdm/lightdm.conf

However this results in some weird behaviour:
LXDE starts perfectly, showing the desktop for a second and then turning all black.
To regain visuals I have to select the whole desktop space with the mouse, lxde will reapear after I have selected that screen area.
Workable but not ideal, any suggestion more than welcome.

EDIT: added

myuser=ALL=(ALL:ALL) ALL

to /etc/sudoers

Desktop appears perfect now, but with error:
GDBus.Error:org.freedesktop.PolicyKit1.Error.Failed: Cannot determine user of subject
added LXDE to


to /etc/xdg/autostart/lxpolkit.desktop
without result :confused: