UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Launcher to run script with elevated permissions

    Scheduled Pinned Locked Moved App Development
    focal fossarootscript
    4 Posts 2 Posters 429 Views 2 Watching
    Loading More Posts
    • 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.
      • B Offline
        Babber
        last edited by

        Dear All,

        I have created a desktop file in ~/.local/share/applications/ to run a script of mine with elevated permissions. This is the important part:
        Exec=env SUDO_ASKPASS=/usr/bin/systemd-ask-password sudo -A /usr/bin/bash /home/phablet/path/to/my/script.sh
        Unfortunately, when I launch this, I am not asked for my password and in the logs, it says: ubuntu-phablet bash[29466]: Failed to query password: Permission denied
        In the terminal, the same agent works for me, e.g. as in SUDO_ASKPASS=/usr/bin/systemd-ask-password sudo -A id. But there, it uses the terminal itself to ask for my password, while in the case of my launcher, I would need a GUI for the same.
        Can anyone help me with this?

        B 1 Reply Last reply Reply Quote 0
        • CiberSheepC CiberSheep moved this topic from OS on
        • B Offline
          Babber @Babber
          last edited by

          I suspect now that this might be the reason: Please let non-root users ask for passwords. Anyway, I cannot see, how the suggested workaround could be implemented in my case, also given that there's no setfacl command on UT...

          arubislanderA 1 Reply Last reply Reply Quote 0
          • arubislanderA Offline
            arubislander @Babber
            last edited by

            @Babber you will probably want to write a QML / C++ wrapper around your scrips, to do what you want. See the Terminal app source code for an idea how to do that.

            πŸ‡¦πŸ‡Ό πŸ‡³πŸ‡± πŸ‡ΊπŸ‡Έ πŸ‡ͺπŸ‡Έ
            Happily running Ubuntu Touch
            Google Pixel 3a (20.04 DEV)
            JingPad (24.04 preview)
            Meizu Pro 5 (16.04 DEV)

            B 1 Reply Last reply Reply Quote 0
            • B Offline
              Babber @arubislander
              last edited by

              @arubislander OK, thank you, I'll have a look at it and consider this option. Cheers

              1 Reply Last reply Reply Quote 0
              • First post
                Last post