X access from under sudo

February 2008


  1. Merge your ~/.Xauthority with the ~/.Xauthority of root:

    sudo xauth merge ~user/.Xauthority

  2. Or for a more permanent solution:

    1. Modify your ~/.bashrc to contain the following:

      export XAUTHORITY=~/.Xauthority
      	    

    2. Modify your /etc/sudoers to contain the following:

      Defaults env_keep += "DISPLAY XAUTHORITY"