I have a computer with large hard drives configured with encrypted home. It so happens, that the same computer also works my family's main kodi media center. Each time my kids want to see a movie, I have to turn it on, and then physically connect a keyboard to it, and type in the password.
I would love to be able to do that remotely.
Of course I also have a root access to the computer.
I am not willing to create another username with automatic login, because most of the media files are encrypted and I want them to stay this way.
The normal combination of export DISPLAY=0:
and source discover_session_bus_addres.sh
and xdotool type my_secret_password
that works for typing into the lock screen doesn't work on the lightm
.
Here is an answer that works under Ubuntu 16.04 with
lightdm
:root
to get access to the lightdm's.Xauthority
, which is located under/var/lib/lightdm/.Xauthority
. Either copy it somewhere where it will be readable by you and drop your root permissions, or simply remain root.XAUTHORITY
to point to that file (e.g.export XAUTHORITY=/var/lib/lightdm/.Xauthority
)DISPLAY
to the active display (export DISPLAY=:0
)xdotool
should work now. TryHere is the workaround that I'm using. It is ugly and rude, but this approach shall work also within Wayland and GDM (Ubuntu 17.10) if the auto login option works at all.
The script should be executed as regular user (that belongs to the sudoers group).
The script will create a backup copy of the file
/etc/lightdm/lightdm.conf
. Then it will generate a new configuration file with auto login option, enabled for the current user. At this point thelightdm
will be restarted and the user will be login by the auto login option. Finally the custom configuration will be removed and the original state of the configuration file will be restored.If GDM in use: the service to be restarted is
gdm3.service
and the configuration file that should be changed is/etc/gdm3/custom.conf
.This works fine for me (from ssh, with lightdm):