Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Shell script on a server. The script is run by a particular user, not root.

The script has the following:

export DISPLAY=:8

But there is an error:

Fatal server error: PAM authentication failed, cannot start X server. Perhaps you do not have console ownership?

Can anyone guide me on how to fix this? I've been Googling but there are numerous different answers so I need a bit of guidance.

Thanks for your time.

Edit: I have found this (enter link description here) which suggests changing the /etc/pam.d/xserver file but I don't really know if that's the right thing to do?

share|improve this question
Why do you want to start an X server from an ssh session? If you want to use X11 clients, use ssh -X and make sure you have Apple's X11 or XQuartz installed. – Sven Sep 15 '11 at 14:31
Sorry I don't think I described the actual problem well enough, I've updated my question. – C0deAttack Sep 15 '11 at 14:48
Where do you want things to be displayed? On your screen or somewhere directly on the server? – Sven Sep 15 '11 at 14:50
I don't actually need to see anything. I am using something called WebDriver to open Firefox to do some automated UI testing. – C0deAttack Sep 15 '11 at 14:53
-x- deleted -x- – voretaq7 Sep 15 '11 at 14:54

WebDriver is really not supposed to be run on a server -- It should be run on a workstation being used to conduct the tests.

If you really want to run the WebDriver test suite on the server then as SvenW pointed out, you're Doing It Wrong™ – You can't just launch an X server on whatever machine you feel like, especially if you're not on the console (that's the Perhaps you do not have console ownership? part of the error message).

The easiest solution in your case is to run an X server on the machine you're SSHing in from, and use ssh -X to forward X clients (like Firefox) requests from the server back to your workstation.

Remove the export DISPLAY=:8 and Xorg $DISPLAY lines from the script when you do this.
ssh -X will automatically set the DISPLAY environment variable for you.

Note that there are other possible solutions ("dummy" X servers that don't display anywhere), but that's getting far more complicated than you need to be at this point.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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