The common solution posted is to run sudo dpkg-reconfigure x11-common which gives a graphical prompt, however, I'm wanting to use this non-interactively.

Scenario is that I'm SSH'd into a machine as root (during Vagrant provisioning) and need to run startx once as a regular user to generate some config files before proceeding to subsequent steps.

I believe the reason I cannot simply su otheruser startx is due to Xauthority/me being connected via SSH as another user...

1 Answer 1


The solution I found was to run the following:

sudo sed -i \
    's/allowed_users=console/allowed_users=anybody/' /etc/X11/Xwrapper.config

Note, that in your situation, the console may be root or another, based on your particular initial configuration*

  • 2
    convincing X to drop root privileges is a rather new feature (xorg 1.16.0 iirc). Details are found in man Xorg.wrap.
    – Sebastian
    Sep 5, 2014 at 6:36
  • 1
    On debian the configuration file "Xwrapper.config" may be present, while the package xserver-xorg-legacy is not installed. In this case it has no effect, so the problems persist after changing the configuration.
    – imsodin
    May 4, 2016 at 9:26

You must log in to answer this question.

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