Ubuntu – How to start a LightDM session via SSH

lightdmssh

I'm connected to an Ubuntu 14.04 machine via SSH and I want to start the lightdm session for testing purposes.

I don't want to forward the X server to my local machine. I just want to start the lightdm session remotely, so I can do some testing via SSH. In other words I want the lightdm session to start just as if the user had logged in themselves.

I've tried various combinations, but none have worked:

# attempt 1
export DISPLAY=:0
sudo xhost +SI:localuser:lightdm
sudo su lightdm -s /bin/bash
/usr/sbin/lightdm-session /usr/share/xsessions/ubuntu.desktop
exit

# attempt 2
export DISPLAY=:0
/usr/sbin/lightdm-session /usr/share/xsessions/ubuntu.desktop

# attempt 3
export DISPLAY=:0
/usr/bin/dbus-launch --exit-with-session /usr/share/xsessions/ubuntu.desktop

How can I start the ubuntu.desktop session via SSH?

Best Answer

lightdm-session is designed to be run from inside LightDM only.

You could set up an automatic login and then start LightDM by configuring automatic login in /etc/lightdm/lightdm.conf, i.e.:

[SeatDefaults] autologin-user=username

Then start / restart lightdm.

Related Question