title: How to run an X program from outside the X session (e.g. from the console or SSH)
body: <p>Without being the person logged in at the console, how do I run an X application and have it display on that X session? Assume I am either root, or I am the same user who logged in, so in principle I have persmission to do this. But how do I convince X of this?</p>
  
  <p>Some examples of situations like this:</p>
  
  <ul>
  <li>Log in with SSH and run a program that displays on the remote computer's screen (<strong>not</strong> tunneled through SSH&mdash;that is totally different)</li>
  <li>A cron job to take a screenshot of the X session via ImageMagick's <code>import</code> command</li>
  <li>Running a keystroke logger for audit purposes</li>
  </ul>
  
  <p>This is a simpler version of <a href="https://stackoverflow.com/questions/1552043/launch-opengl-app-straight-from-a-windowless-linux-terminal">Launch OpenGL app straight from a windowless Linux Terminal</a></p>