Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

over ssh -

$xclock
$sudo su -

#xclock
X11 connection rejected because of wrong authentication.

so I do -

$xauth list /*copy the lines*/ 
$sudo su -
#xauth add /*paste the lines*/
#xclock /* works */

I am fed up doing this on every login, how can I persist it?

share|improve this question
  1. Don't run X11 software as root. Seriously.

  2. Use sudo -s or sudo -i instead of sudo su.

  3. Add XAUTHORITY to sudo's env_keep configuration option. It should point to an Xauthority file in your home directory.

share|improve this answer
    
sudo -s was what helped me. Thanks +1. – enthusiasticgeek Dec 26 '13 at 16:34
1  
Can you provide a pointer why X11 shouldn't be run as root? – Abdull Jan 19 '14 at 1:31

You must log in to answer this question.

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