Skip to content

Define a non-root user? #4

@bilderbuchi

Description

@bilderbuchi

I have played around with the openmodelica/openmodelica:v1.21.0-ompython Docker image -- quite useful!

One thing I found curious is that these images have not defined & used a non-root user, like you can find e.g. here.

This leads to the problem that even basic OMPython usage is not possible because omc does not like being run as root, e.g. doing docker run -it openmodelica/openmodelica:v1.21.0-ompython:

root@cc828498295a:~# python3 -c "from OMPython import OMCSessionZMQ;omc = OMCSessionZMQ()"
2023-08-10 11:43:25,730 - OMPython - ERROR - OMC Server did not start. Please start it! Log-file says:
Error: You are trying to run OpenModelica as a server using the root user.
This is a very bad idea:
* The socket interface does not authenticate the user.
* OpenModelica allows execution of arbitrary commands.
Execution failed!

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.10/dist-packages/OMPython/__init__.py", line 707, in __init__
    self._connect_to_omc(timeout)
  File "/usr/local/lib/python3.10/dist-packages/OMPython/__init__.py", line 737, in _connect_to_omc
    raise Exception("OMC Server did not start (timeout=%f). Could not open file %s" % (timeout,self._port_file))
Exception: OMC Server did not start (timeout=10.000000). Could not open file /tmp/openmodelica.root.port.76d9b26890fd41f082d70f1485c8ad19

Is that intentional/should that be changed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions