Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Permission Denied to /etc/microlab/microlab.ini #242

Open
zenny opened this issue Sep 5, 2024 · 2 comments
Open

[BUG] Permission Denied to /etc/microlab/microlab.ini #242

zenny opened this issue Sep 5, 2024 · 2 comments

Comments

@zenny
Copy link

zenny commented Sep 5, 2024

Hi,

Thanks for posting an interesting repo.

Trying to build a development server to try with python3 main.py.

$ python main.py
Traceback (most recent call last):
  File "/home/user/Downloads/solderless-microlab/backend/main.py", line 11, in <module>
    import config
  File "/home/user/Downloads/solderless-microlab/backend/config.py", line 125, in <module>
    microlabConfig = MicrolabConfig()
                     ^^^^^^^^^^^^^^^^
  File "/home/user/Downloads/solderless-microlab/backend/config.py", line 24, in __init__
    makedirs(path.dirname(configFileName), exist_ok=True)
  File "<frozen os>", line 225, in makedirs
PermissionError: [Errno 13] Permission denied: '/etc/microlab'

Since the entire build was built as a user permission, why running the main.py searches for an inaccesible config in /etc/microlab/microlab.ini making it unsafe? I could not find microlab.ini examples in this repo either.

Cheers,
/zenny

@sparklestheunicorn
Copy link
Collaborator

In current production environments (on a RPi), running the python script using sudo is necessary to access the GPIO pins, so that's the way the software and scripts have been designed. We have made some efforts to make everything run as a regular user, but it hasn't been high enough priority compared to other recent features and release activity.

I'll leave this open until we (a) figure out how to remove the need to run the backend scripts as super user or (b) determine that's the only way to do things and see if there's a workaround for development on non-pi machines.

@zenny
Copy link
Author

zenny commented Sep 6, 2024

In current production environments (on a RPi), running the python script using sudo is necessary to access the GPIO pins, so that's the way the software and scripts have been designed. We have made some efforts to make everything run as a regular user, but it hasn't been high enough priority compared to other recent features and release activity.

I'll leave this open until we (a) figure out how to remove the need to run the backend scripts as super user or (b) determine that's the only way to do things and see if there's a workaround for development on non-pi machines.

@sparklestheunicorn Thanks for the reply.

What I assigned the ownership of the following directories to the user as an alternative way than using sudo itself:

sudo mkdir -p /etc/microlab
sudo chown -R $USER:$USER /etc/microlab
sudo chown -R $USER:$USER path/to/this/repo/backend/env
sudo chown -R $USER:$USER /var/log/microlab
sudo chown -R $USER:$USER /var/lib/microlab

to make $USER to run the script, but not ideal, imho, securitywise.

Thanks for the wonderful work and look forward to changes you are planning to overcome the bottleneck.

Cheers,
/zenny

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants