2

My setup is:

  • a Raspberry Pi, running the latest Raspbian (fully updated), a self-compiled Python 3.3.3
  • a Mac running Mavericks (10.9)

I'm AFP-ed, SSH-ed and VNC-ed to my RPi, and I can run all the command-line scripts I wrote, and also I can open any installed GUI applications, however, when I want to run a tkinter-based GUI app, to control some hardwares connected to the GPIO, I'm having this error message:

enter image description here

Client is not authorized to connect to ServerTraceback (most recent call last):
    ...
_tkinter.TclError: couldn't connect to display ":1"

My guess is, that this is related to the fact, that there is no physical display attached to the RPi, although I don't know how to solve this situation.

Thanks in advance!


I've already asked this on StackOverflow but I thought maybe this section is a better place for my problem.

1 Answer 1

5

It is the sudo. sudo in its standard configuration resets the XAUTHORITY environment variable. see the xauth and sudo man pages for details.

the relevant part of my /etc/sudoers is:

Defaults    env_reset
Defaults    secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Defaults    env_keep += "DISPLAY"
Defaults    env_keep += "XAUTHORITY"
7
  • I think your solution should be the one (not the SO version as you pointed out, it is more dangerous). Although I read all the infos in the auth man page, since I'm pretty new to Linux, I still don't know what exactly I have to do..
    – Peter Varo
    Commented Nov 30, 2013 at 17:17
  • You are a lifesaver, thank you so much! Although to make this thing to work, I also needed to add export XAUTHORITY=~/.Xauthority to my ~/.bashrc file.
    – Peter Varo
    Commented Nov 30, 2013 at 18:04
  • 1
    the only problem with that is that if XAUTHORITY is correctly set to something else, this breaks it. I use if [ -z "$XAUTHORITY" ] ; then if [ -e $HOME/.Xauthority ] ; then export XAUTHORITY=$HOME/.Xauthority; fi; fi
    – hildred
    Commented Nov 30, 2013 at 18:08
  • 2
    It's great to see a new member contributing so much to this website. +1, and keep it up. We need more people like you.
    – syb0rg
    Commented Nov 30, 2013 at 20:26
  • 2
    @syb0rg I've encountered other experienced users who would have shot this question down with "this question has nothing to do with Raspberry Pi, you should ask it somewhere else". This site needs more people like you ;) Commented Apr 5, 2015 at 9:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.