garyk1968
Posts: 16
Joined: Thu Feb 09, 2012 8:50 am
Location: Bedfordshire
Contact: Website

X Forwarding not working with sudo

Fri Jan 23, 2015 11:22 am

Hi all,

I managed to get X Forwarding working with my pi b+ and mabook. All good so far and I can run a remote LXDE desktop.

However playing with python and trying to use the GPIO I need to run idle as sudo. However I cannot do this. I get the following error:

Code: Select all

X11 connection rejected because of wrong authentication.
Traceback (most recent call last):
  File "/usr/bin/idle", line 5, in <module>
    main()
  File "/usr/lib/python2.7/idlelib/PyShell.py", line 1427, in main
    root = Tk(className="Idle")
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1712, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: couldn't connect to display "localhost:10.0"
I have checked permissions and ownership of ~/.Xauthority, thats all fine.
I have tried using the export display='IP:x.x.x.x'

but nothing works. Abit stuck! Can anyone help?

Thanks!

Gary

ghans
Posts: 7873
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: X Forwarding not working with sudo

Fri Jan 23, 2015 11:47 am

Try using gksudo instead of sudo.

ghans
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

garyk1968
Posts: 16
Joined: Thu Feb 09, 2012 8:50 am
Location: Bedfordshire
Contact: Website

Re: X Forwarding not working with sudo

Fri Jan 23, 2015 12:03 pm

thats it!

thank you

Return to “Troubleshooting”