Take the 2-minute tour ×

over ssh -

$sudo su -

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
add comment

1 Answer

  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
Can you provide a pointer why X11 shouldn't be run as root? –  Abdull Jan 19 at 1:31
add comment

Your Answer


