2

I am trying to run idle with root privileges so as to use the RPi.GPIO module.

The RPi 2 is headless and I am using TightVNC Server. I get the error

Client is not authorized to connect to ServerTraceback

From googling I have discovered that this is a conflict with VNC but I have not been able to find a solution.

Strangely I somehow managed to resolve this problem when using the old Model B but I stupidly did not make a note of how.

Can anybody help?

Greenonline
2,9725 gold badges27 silver badges38 bronze badges
asked Jul 15, 2015 at 10:18
1
  • Been there. :) I remember adding something to ~/.bashrc. Not sure though. :( :( Commented Jul 15, 2015 at 10:30

2 Answers 2

1

Try this:

Run the vncserver as root

sudo vncserver

connect to the root vnc session then run

sudo DISPLAY=:2 idle # with the right number for root's VNC.

Source: trouble running idle as a root using vnc

If that doesn't work, then something is up with XAUTHORITY.

Try adding

xhost +local:root

to .bashrc as dastaan suggests.


Just seen this:

In fact no need for that, changing sudo /usr/bin/idle to gksu /usr/bin/idle is all is needed to make this work.

Source: vnc-problem with idle running as sudo on raspberry pi

answered Jul 15, 2015 at 17:49
1
  • 1
    Thank you greenonline gksu /usr/bin/idle does it. For those who see this you can find the file to change by Menu>programing>Python(2/3) and then right click Commented Jul 16, 2015 at 18:00
0

Ok, I found the solution. Follow these steps.

  1. Open .bashrc by nano ~/.bashrc
  2. Paste following code at the end.

    if [ -z "$XAUTHORITY" ]; then
     if [ -e $HOME/.Xauthority ]; then
     export XAUTHORITY=$HOME/.Xauthority;
     fi;
    fi
    
  3. Reboot by sudo reboot to make it effective.

It should work. :)

Hope it helps.

answered Jul 16, 2015 at 8:40

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.