Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Running application with user privillegions.
Qt 6.11 is out! See what's new in the release blog

Running application with user privillegions.

Scheduled Pinned Locked Moved Unsolved General and Desktop
50 Posts 10 Posters 4.1k Views 3 Watching
  • 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.
  • JonBJ JonB

    @nicholas_ru
    Did you even try it?? Debian man page https://manpages.debian.org/bookworm/coreutils/chmod.1.en.html

    Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=][0-7]+'.

    How else would you setuid under Debian? No point my suggesting things if they do work but you say they do not.

    .First post with running command very nice,but not full.

    If you mean @Joe-von-Habsburg 's QString command = QString("echo %1 | sudo -S %2").arg(1234).arg("ifconfig") it won't work as written if passed to QProcess::start().... But I am getting a bit dispirited trying to help you so up to you.

    N Offline
    N Offline
    nicholas_ru
    wrote on last edited by nicholas_ru
    #20

    @JonB i am think in Qt framework must be integrated this is function.

    JonBJ 1 Reply Last reply
    0
    • N nicholas_ru

      @JonB i am think in Qt framework must be integrated this is function.

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

      @nicholas_ru No idea what you mean. You have plenty of answers & suggestions above, so over to you to do something....

      N 1 Reply Last reply
      0
      • JonBJ JonB

        @nicholas_ru No idea what you mean. You have plenty of answers & suggestions above, so over to you to do something....

        N Offline
        N Offline
        nicholas_ru
        wrote on last edited by
        #22

        @JonB if QProcess running with root true, if without false.

        JonBJ 1 Reply Last reply
        0
        • N nicholas_ru

          @JonB if QProcess running with root true, if without false.

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

          @nicholas_ru
          Again, I don't know what that phrase means. You might trying typing in your questions/answers with full detail in your native language into Google and asking it to translate to English, that may give a more meaningful question.

          We have explained what the possibilities are for running programs under Linux setuid/as root. You have to pick one. You have to try the suggestions you have been given. I don't even believe what you said about chmod u+s not being available under your Debian. Qt as a framework has nothing to say or do about setuid. QProcess can be used to run other programs in the standard Linux exec-type way. Just because you say "i am think in Qt framework must be integrated this is function." does not make it so there is magically something else in Qt we have not discussed.

          At this point I don't think anybody here knows what you actually want, what your problem is or what you have tried from the suggestions.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SimonSchroeder
            wrote on last edited by
            #24

            There is a reason why you can't just run anything with root privileges. And under normal circumstance you should not try to circumvent it. The most important question is if you really need to run something as root (while your own software is not started with root privileges). Qt does not provide anything special to run a process as root. You need to use OS functionality to run an elevated process (you can use QProcess to start sudo or use any of the other methods mentioned before). In the case of sudo it is up to you to ask the user for the password and hand it to sudo. But, even this is a bad idea because it is really easy to leak the password for an attacker.

            1 Reply Last reply
            0
            • N Offline
              N Offline
              nicholas_ru
              wrote last edited by nicholas_ru
              #25

              No,no attacker not recieve permissions, but idea not bad. I love Qt and this function for me needed for devleopment, because user also must be entering password.

              JonBJ 1 Reply Last reply
              0
              • N nicholas_ru

                No,no attacker not recieve permissions, but idea not bad. I love Qt and this function for me needed for devleopment, because user also must be entering password.

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote last edited by
                #26

                @nicholas_ru
                We have given you the alternative approaches for running setuid. Qt itself is not going to add anything in this area.

                1 Reply Last reply
                0
                • N Offline
                  N Offline
                  nicholas_ru
                  wrote last edited by
                  #27

                  Well then my development will be limited and I'll have to look for other ways to implement it.

                  JonBJ SGaistS 2 Replies Last reply
                  0
                  • N nicholas_ru

                    Well then my development will be limited and I'll have to look for other ways to implement it.

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote last edited by JonB
                    #28

                    @nicholas_ru
                    Gave you the 3 ways to implement it above in https://forum.qt.io/post/837390. Don't know what other ways you want or need, don't know why you don't pursue these. You seem to ask the question but not prepared to follow the suggestions. Up to you.

                    1 Reply Last reply
                    0
                    • N nicholas_ru

                      Well then my development will be limited and I'll have to look for other ways to implement it.

                      SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote last edited by
                      #29

                      @nicholas_ru Since you used GParted as an example, use the same technique they use.

                      https://gitlab.gnome.org/GNOME/gparted/-/blob/master/src/main.cc?ref_type=heads
                      https://gitlab.gnome.org/GNOME/gparted/-/blob/master/org.gnome.gparted.policy.in.in?ref_type=heads

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      Pl45m4P 1 Reply Last reply
                      3
                      • SGaistS SGaist

                        @nicholas_ru Since you used GParted as an example, use the same technique they use.

                        https://gitlab.gnome.org/GNOME/gparted/-/blob/master/src/main.cc?ref_type=heads
                        https://gitlab.gnome.org/GNOME/gparted/-/blob/master/org.gnome.gparted.policy.in.in?ref_type=heads

                        Pl45m4P Offline
                        Pl45m4P Offline
                        Pl45m4
                        wrote last edited by
                        #30

                        @SGaist

                        Nice to know :)

                        *.in.in file?!
                        So a file template for a file template for an actual file? :D


                        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                        ~E. W. Dijkstra

                        SGaistS 1 Reply Last reply
                        0
                        • Pl45m4P Pl45m4

                          @SGaist

                          Nice to know :)

                          *.in.in file?!
                          So a file template for a file template for an actual file? :D

                          SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote last edited by
                          #31

                          @Pl45m4 said in Running application with user privillegions.:

                          @SGaist

                          Nice to know :)

                          *.in.in file?!
                          So a file template for a file template for an actual file? :D

                          There's never enough indirection... :-D

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          0
                          • K Offline
                            K Offline
                            kaixoo
                            wrote last edited by
                            #32

                            I think he wants to run a process with administrative privileges by showing a UAC (User Account Control) dialog. This is what, for example, balenaEtcher does when it needs to burn a drive. Is this correct?

                            JonBJ 1 Reply Last reply
                            0
                            • K kaixoo

                              I think he wants to run a process with administrative privileges by showing a UAC (User Account Control) dialog. This is what, for example, balenaEtcher does when it needs to burn a drive. Is this correct?

                              JonBJ Offline
                              JonBJ Offline
                              JonB
                              wrote last edited by
                              #33

                              @kaixoo If you read the OP is under Linux, so there is no such thing as "UAC".

                              1 Reply Last reply
                              0
                              • N Offline
                                N Offline
                                nicholas_ru
                                wrote last edited by nicholas_ru
                                #34

                                Linus Torvalds hate C++ because it dificult and not t easy.Not UAC, read up, Linux.It so for me, i liked, Unixpled

                                JonBJ 1 Reply Last reply
                                0
                                • J.HilkJ Offline
                                  J.HilkJ Offline
                                  J.Hilk
                                  Moderators
                                  wrote last edited by
                                  #35

                                  Torvalds allowed Rust into the kernel (2022) but not C++.

                                  Grandpa is doing his own thing and I stopped questioning stuff.


                                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                                  Q: What's that?
                                  A: It's blue light.
                                  Q: What does it do?
                                  A: It turns blue.

                                  N 1 Reply Last reply
                                  1
                                  • N nicholas_ru

                                    Linus Torvalds hate C++ because it dificult and not t easy.Not UAC, read up, Linux.It so for me, i liked, Unixpled

                                    JonBJ Offline
                                    JonBJ Offline
                                    JonB
                                    wrote last edited by
                                    #36

                                    @nicholas_ru said in Running application with user privillegions.:

                                    Linus Torvalds hate C++ because it dificult and not t easy.Not UAC, read up, Linux.It so for me, i liked, Unixpled

                                    Don't know what you're saying, but the ability to set or change user privilege has nothing to do with C++ and really little to do with programming.

                                    1 Reply Last reply
                                    0
                                    • N Offline
                                      N Offline
                                      nicholas_ru
                                      wrote last edited by nicholas_ru
                                      #37

                                      It's talk about them, that code must be easy, and user permissions change must be flug also easy.

                                      Pl45m4P 1 Reply Last reply
                                      0
                                      • N nicholas_ru

                                        It's talk about them, that code must be easy, and user permissions change must be flug also easy.

                                        Pl45m4P Offline
                                        Pl45m4P Offline
                                        Pl45m4
                                        wrote last edited by
                                        #38

                                        @nicholas_ru

                                        If changing user permissions were that easy, it would defeat its purpose.


                                        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                                        ~E. W. Dijkstra

                                        1 Reply Last reply
                                        0
                                        • N Offline
                                          N Offline
                                          nicholas_ru
                                          wrote last edited by
                                          #39

                                          It must easy for developers and users.

                                          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