After I login to a server using ssh and try to initiate X11 I got the below error message:

X: user not authorized to run the X server, aborting.
xinit: giving up
xinit: server error

by checking the /etc/X11/Xwrapper.config, it shows


I am wondering how to fix this issue. I also don't have the root privilege for some setting changes.

  • did you try changing the word console to anybody yet ? – MelBurslan Aug 18 '16 at 18:17
  • It turns out I don't have root privilege to make that change. It seems also not suggested for security reasons. – Dadong Zhang Aug 18 '16 at 18:33
  • What are you trying to do?   Please respond to Thomas Dickey’s answer. – G-Man Says 'Reinstate Monica' Oct 21 '18 at 3:33
  • If you aren't root, you aren't the systems administrator and are therefore not the person who should be making systemwide configuration changes. Perhaps you should talk to the person who does have root privileges and ask them why you're not allowed to startx. – Shadur Oct 21 '18 at 20:06
  • If you want to run an X application on the remote host, it may be more useful to start the X server on the local host, then login to the remote with X forwarding e.g 'ssh -XY remote'. SSH should then set the DISPLAY environment variable properly, such that any X application run on the remote will be displayed in the local X server. (This may not work as well, for some OpenGL applications. afaict it works OK for most other applications, including the Chrome/Chromium browser) – Sean Champ Aug 8 at 20:28

It depends on what you are trying to do:

  • if you had permissions, at best you would get X running, using the console of the computer which you connected to for its display. You wouldn't get X running on the local machine from which you ran ssh.
  • if you logged in on the console, you would have permissions to startx — still on that display.
  • if you are trying to run an X application on the server, displaying on your local machine, the way to do this is to have X running on the local machine, and using X forwarding (establishing an authorized connection) run the application via ssh, displaying on your local machine. You do not have to startx on the remote machine for that.

Further reading:

dpkg-reconfigure x11-common

This will work.

  • How will it work? What does it do? – Zv_oDD Jul 21 '18 at 6:20
  • 1
    @Zv_oDD Assuming a certain dpkg configuration, e.g by default, the shell command may result in a dialogue window being displayed. The dialogue window may present an option for graphically selecting, "Users allowed to start the X server," with options, "Root only", "Console Users Only," or "Anybody." Of course, "Root Only," might not be recommended. As the same dialogue window denotes, this pertains to concerns attendant of running the X server as setuid. – Sean Champ Aug 8 at 20:10
  • Thanks, now this answer is far better. – Zv_oDD Aug 13 at 4:20

For my Debian jessie, no session manager, only X11, xorg and mwm (Motif window manager), I got this problem only after copying my home folder from another Debian jessie host. Turns out that when I moved the ~/.Xsession to a temporary ~/old folder, it corrected the issue.

# mv ~/.Xsession ~/old

In addition, I found out that gnu-screen would generate "X: user not authorized to run the x server, aborting."

  • As well as with GNU screen, this may also occur when running startx under tmux. Perhaps it has something to do with PTY allocation, broadly. There may be a partial workaround in running 'startx' directly from the login pty. – Sean Champ Aug 8 at 20:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.