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

Starting as superuser will break permissions of tmp files #3142

Open
SekoiaTree opened this issue Nov 18, 2022 · 2 comments
Open

Starting as superuser will break permissions of tmp files #3142

SekoiaTree opened this issue Nov 18, 2022 · 2 comments

Comments

@SekoiaTree
Copy link

Describe the bug
Launching start_mycroft.sh as superuser makes the files in /tmp/mycroft only readable to root. This crashes the bus when launched in non-superuser. Launching as root causes other issues.

To Reproduce
Steps to reproduce the behavior:

  1. Run sudo ./start-mycroft.sh all
  2. Run sudo ./stop-mycroft.sh
  3. Run ./start-mycroft.sh all
  4. Run ./start-mycroft.sh cli
  5. Check logs, see crash.

Expected behavior
CLI connects to bus.

Log files

PermissionError: [Errno 13] Permission denied: '/tmp/mycroft/service.pid'
2022-11-19 00:39:20.714 | INFO     | 95140 | __main__:main:50 | Starting message bus service...
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "[removed by SekoiaTree]/mycroft-core/mycroft/messagebus/service/__main__.py", line 72, in <module>
    main()
  File "[removed by SekoiaTree]/mycroft-core/mycroft/messagebus/service/__main__.py", line 52, in main
    lock = Lock("service")
  File "[removed by SekoiaTree]/mycroft-core/mycroft/lock/__init__.py", line 119, in __init__
    self.create()
  File "[removed by SekoiaTree]/mycroft-core/mycroft/lock/__init__.py", line 173, in create
    self.touch()
  File "[removed by SekoiaTree]/mycroft-core/mycroft/lock/__init__.py", line 160, in touch
    with open(self.path, 'w') as L:
PermissionError: [Errno 13] Permission denied: '/tmp/mycroft/service.pid'

**Environment (please complete the following information):**
 - Device type: desktop
 - OS: Ubuntu (Pop!_OS)
 - Mycroft-core version: 21.2.2

**Additional context**
Probably shouldn't run it as sudo, but still, feel like it's worth reporting. Maybe a check if running as root with a warning and an override?

Since the broken files are in /tmp/mycroft/, removing those files fixes this entirely (until you run the bus as superuser again).
@krisgesling
Copy link
Contributor

Hi there, thanks for reporting this.

I'm guessing you've already come to the conclusion that you shouldn't run Mycroft with sudo. But it would be nice to add in something that actually prevents people from causing this. Or at least makes them jump through a small hoop to make sure they truly want to do it.

I've marked it as help wanted so others might take a look. It's not something we'll be prioritizing at the moment.

Thanks

@SekoiaTree
Copy link
Author

Understandable, thanks!

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

No branches or pull requests

2 participants