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 861 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
            JingPad (24.04-1.x daily)
            OnePlus Nord N10 5G (24.04-2.x daily)
            PinePhone OG (20.04)
            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

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better πŸ’—

              Register Login
              • First post
                Last post