Installed thonny using sudo but can't run from desktop

Ubuntu 22.04.4 LTS
kubuntu 22.04

I downloaded the thonny bash script from thonny git.
from terminal i typed sudo bash thonny-4.1.4.bash
it installed fine.
If I run in terminal sudo /root/apps/thonny/bin/thonny it runs and opens fine.
If I try and run it from Kubuntu desktop I get an error that the file doesn’t exist. I’m guessing that as my user I don’t have access to that file being that its in the root folder.

Question:
Why are files installed into root folder with root user:group permissions when I use sudo, if I can’t be root to run the app from the desktop?

I always follow install instructions which always reference using sudo so
this goes for everything I do resulting in lots of permission denied errors but thats for another day.
Thanks for your help,
Kadam.

Asked By: kadam

||

Some installers may attempt to install the application just for the user running the installer, which is what happened here;

Unnecessarily running bash thonny-4.1.4.bash with sudo made Bash run as root and in a modified envinroment;

I’m not claiming one of these methods was the one used by the installer to determine the target user / the target user’s home directory to which install the files, but, for example, here are some things that may look different to a shell spawned with sudo:

% sudo bash -c 'printenv' | grep -P '^(HOME|USER)='
HOME=/root # the $HOME environment variable
USER=root # the $USER environment variable
% sudo bash -c 'id -u'
0 # the effective user's UID
% sudo bash -c 'id -un'
root # the effective user's username

The solution, simply, would be to run the script without sudo:

bash thonny-4.1.4.bash
Answered By: kos