Home > Mobile >  tkinter misbehave with sudo when remote desktop on Ubuntu 21.10 xrdp
tkinter misbehave with sudo when remote desktop on Ubuntu 21.10 xrdp

Time:02-05

SETUP

I have a python3 application that creates a gui using tkinter. It runs on a Raspberry Pi 4 running Ubuntu 21.10. I'm connected using a remote desktop with the Tkinter fails to create GUI

When I run the application as user, tkinter is able to create the GUI, but now the application does not have permission to interface with root drivers

python3 /home/ubuntu/Robotics/QuadrupedRobot/StanfordQuadruped/calibrate_tool.py

Permission denied

QUESTION

Is there a way to make tkinter work with root permissions on remote desktop, or to write on root files without giving root permission to the full application?

Is there a something I'm doing wrong with the setup?

SOLUTION

enter image description here

CodePudding user response:

This is an X Windows security issue preventing the sudo user accessing the display created by the logged on user. If you're not worried about security on your local network then running the command 'xhost ' will disable all security on the X Windows Display and allow the sudo user to access the display.

    pi@pi4desktop:~ $ xhost  
    access control disabled, clients can connect from any host

Then you should be able to run your tkinter application using sudo.

  •  Tags:  
  • Related