I am attempting to load a python script that launches a Firefox Geckodriver under Selenium whenever a specific kiosk user logs in to the GUI.

I've tried launching this via .profile, however geckodriver throws an error "Error: no DISPLAY environment variable specified". I've tried loading this from .bashrc, .bash_profile, and .xsession (not used in my case) with little luck. The browser will launch with the line in .bashrc, but only when a terminal is opened manually and not when the user logs in graphically.

How do I launch this python script on login for this user with the display environment it needs?

1 Answer 1


I was able to fix this issue by configuring the following:

  1. Open a terminal on the user you'd like to configure this for and create a ~/.config/autostart/kiosk.desktop in a text editor (nano ~/.config/autostart/kiosk.desktop). You may need to create the autostart directory in .config as well.

  2. Within the kiosk.desktop file input:

[Desktop Entry]
Exec=python3 /path/to/script/init.py

Now when that user logs into their desktop, this script will automatically trigger within the graphics environment.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .