Cannot ssh -X then run ‘sudo synaptic’

I’m not sure when it happened. Perhaps it’s something to do with migrating to Linux Mint Debian Edition, or it’s an update that introduced improved security. The problem is that when I use ssh -X to get to another host, I can no longer sudo X applications on the destination host. i.e.

dougie@phoenix ~ $ ssh -X osprey
Linux osprey 3.0.0-1-486 #1 Sun Jul 24 13:43:13 UTC 2011 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sun NovĀ  6 19:11:50 2011 from phoenix
dougie@osprey ~ $
dougie@osprey ~ $ sudo synaptic
X11 connection rejected because of wrong authentication.
X11 connection rejected because of wrong authentication.
X11 connection rejected because of wrong authentication.
X11 connection rejected because of wrong authentication.

(synaptic:4263): Gtk-WARNING **: cannot open display: localhost:10.0
dougie@osprey ~ $

The problem seems to be resolvable by setting the XAUTHORITY environment variable, as explained in this post. Adding this line

XAUTHORITY=${HOME}/.Xauthority export XAUTHORITY

to .bashrc makes the problem go away.

(Visited 14 times, 1 visits today)

Leave a Reply

Your e-mail address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.