Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Using d-bus to start root binaray with usr binary
Qt 6.11 is out! See what's new in the release blog

Using d-bus to start root binaray with usr binary

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
13 Posts 3 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    d.rein
    wrote on last edited by
    #1

    Hello,
    i have an embedded linux system where i have 2 or more processes which are running parallel. One of these processes is a root process. Now i have to send a message from a non root process to the root process, which shall call one of its functions. in this case just print out a qDebug() - just for testing.
    I have been instructed to use QDBusConnection.
    I have absolutely no Idea how to solve this...
    Hope anyone can help me :-)

    jsulmJ 1 Reply Last reply
    0
    • D d.rein

      Hello,
      i have an embedded linux system where i have 2 or more processes which are running parallel. One of these processes is a root process. Now i have to send a message from a non root process to the root process, which shall call one of its functions. in this case just print out a qDebug() - just for testing.
      I have been instructed to use QDBusConnection.
      I have absolutely no Idea how to solve this...
      Hope anyone can help me :-)

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @d-rein You should start here if you want to use DBus: https://doc.qt.io/qt-5/qtdbus-index.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        d.rein
        wrote on last edited by
        #3

        Thanks. But is it possible to advise a root process to do somethang as local user process? Or very complicated?

        jsulmJ JonBJ 2 Replies Last reply
        0
        • D d.rein

          Thanks. But is it possible to advise a root process to do somethang as local user process? Or very complicated?

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @d-rein What do you mean by "root process"? A process running with root privileges?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          D 1 Reply Last reply
          0
          • D d.rein

            Thanks. But is it possible to advise a root process to do somethang as local user process? Or very complicated?

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #5

            @d-rein said in Using d-bus to start root binaray with usr binary:

            But is it possible to advise a root process to do somethang as local user process? Or very complicated?

            It's "complicated", unless you know about seteuid() et al. and how to use them :)

            I know nothing about "DBusses" :) But if your message is, say, something across a socket connecting two processes, it is "OK" for one process to run as root and the other to run non-root, nothing actually forbids that. Of course, you do have to be careful that if a root process is asked to do something, particularly by a non-root process, the action is "safe". For example, if the root process received a message containing an arbitrary OS command from another process, and the other process sent /bin/rm -fr /, it wouldn't be very good if the root process did execute that...!

            D 1 Reply Last reply
            0
            • jsulmJ jsulm

              @d-rein What do you mean by "root process"? A process running with root privileges?

              D Offline
              D Offline
              d.rein
              wrote on last edited by
              #6

              @jsulm Yes on my system i have 15 processes running parallel. At the moment, if you log into the system you have root. What i have to do is the change this so when i user is logging in he has only user privileges. There is just on process that needs root privileges. The networkmanager. This is the process i have to advice to do something

              1 Reply Last reply
              0
              • JonBJ JonB

                @d-rein said in Using d-bus to start root binaray with usr binary:

                But is it possible to advise a root process to do somethang as local user process? Or very complicated?

                It's "complicated", unless you know about seteuid() et al. and how to use them :)

                I know nothing about "DBusses" :) But if your message is, say, something across a socket connecting two processes, it is "OK" for one process to run as root and the other to run non-root, nothing actually forbids that. Of course, you do have to be careful that if a root process is asked to do something, particularly by a non-root process, the action is "safe". For example, if the root process received a message containing an arbitrary OS command from another process, and the other process sent /bin/rm -fr /, it wouldn't be very good if the root process did execute that...!

                D Offline
                D Offline
                d.rein
                wrote on last edited by
                #7

                It's "complicated", unless you know about seteuid() et al. and how to use them :)

                No. I dont know anything about it. But this can be changed :-)

                And yes the connection to my systeem is over a websocket and shall start a non root process. actually we already use dbus in our system. But actuelly every process is started by a root user. So there is no problem but we want to change all except one to non root and just allow on process to run with root privs

                jsulmJ 1 Reply Last reply
                0
                • D d.rein

                  It's "complicated", unless you know about seteuid() et al. and how to use them :)

                  No. I dont know anything about it. But this can be changed :-)

                  And yes the connection to my systeem is over a websocket and shall start a non root process. actually we already use dbus in our system. But actuelly every process is started by a root user. So there is no problem but we want to change all except one to non root and just allow on process to run with root privs

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @d-rein said in Using d-bus to start root binaray with usr binary:

                  But actuelly every process is started by a root user

                  How exactly do you start these processes? Do you use systemd?

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    d.rein
                    wrote on last edited by
                    #9

                    they are binaries

                    JonBJ 1 Reply Last reply
                    0
                    • D d.rein

                      they are binaries

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by
                      #10

                      @d-rein
                      That is not @jsulm's question. Something must start these processes: he is asking whether in your case they are all launched from systemd?

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        d.rein
                        wrote on last edited by
                        #11

                        Yes. Sry

                        jsulmJ 1 Reply Last reply
                        0
                        • D d.rein

                          Yes. Sry

                          jsulmJ Offline
                          jsulmJ Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          @d-rein In that case you can specify the user the process should use in its service file, see https://askubuntu.com/questions/676007/how-do-i-make-my-systemd-service-run-via-specific-user-and-start-on-boot
                          "You can specify the directives User= and Group= in the [Service] section of the unit file.".

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          2
                          • D Offline
                            D Offline
                            d.rein
                            wrote on last edited by
                            #13

                            Thank you.
                            I have only recently joined my company and have not yet fully integrated into the project. I will ask again about this.

                            1 Reply Last reply
                            0

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved