Is there a way to make the polkit agent default to the currently logged in user?












1















Does anyone know how to configure polkit-gnome-authentication-agent-1 to default to the current user initially when handling a request, or alternatively if one of the other polkit agents has this ability?





When authenticating to perform a polkit action with an agent like polkit-gnome-authentication-agent-1, because I have multiple users in the wheel group I'm provided a drop down to select which user to authenticate as.



This is an irritating extra step, when in most cases the user I want to authenticate as, is the currently logged in user*. My preferred behaviour is that the currently logged in user is pre-selected and I'm taken straight to password entry, with the option to change to another user if that's what I want.



I'm aware that it's possible to restrict the users that appear in the list via polkit rules but my naive understanding of those rules is they change who is allowed to authenticate for certain actions, and that this behaviour is instead in the realm of the polkit GUI agent. Or am I wrong and that the default selection is something that can be set via polkit rules?



To reiterate I don't wish to change which users/groups are allowed to authenticate to perform polkit actions but just make the UI a little quicker to move through with minimum keypresses and definitely no rodents.



* I fully acknowledge that this might be the most sensible behaviour for most deployments, but for me its awkward.










share|improve this question



























    1















    Does anyone know how to configure polkit-gnome-authentication-agent-1 to default to the current user initially when handling a request, or alternatively if one of the other polkit agents has this ability?





    When authenticating to perform a polkit action with an agent like polkit-gnome-authentication-agent-1, because I have multiple users in the wheel group I'm provided a drop down to select which user to authenticate as.



    This is an irritating extra step, when in most cases the user I want to authenticate as, is the currently logged in user*. My preferred behaviour is that the currently logged in user is pre-selected and I'm taken straight to password entry, with the option to change to another user if that's what I want.



    I'm aware that it's possible to restrict the users that appear in the list via polkit rules but my naive understanding of those rules is they change who is allowed to authenticate for certain actions, and that this behaviour is instead in the realm of the polkit GUI agent. Or am I wrong and that the default selection is something that can be set via polkit rules?



    To reiterate I don't wish to change which users/groups are allowed to authenticate to perform polkit actions but just make the UI a little quicker to move through with minimum keypresses and definitely no rodents.



    * I fully acknowledge that this might be the most sensible behaviour for most deployments, but for me its awkward.










    share|improve this question

























      1












      1








      1








      Does anyone know how to configure polkit-gnome-authentication-agent-1 to default to the current user initially when handling a request, or alternatively if one of the other polkit agents has this ability?





      When authenticating to perform a polkit action with an agent like polkit-gnome-authentication-agent-1, because I have multiple users in the wheel group I'm provided a drop down to select which user to authenticate as.



      This is an irritating extra step, when in most cases the user I want to authenticate as, is the currently logged in user*. My preferred behaviour is that the currently logged in user is pre-selected and I'm taken straight to password entry, with the option to change to another user if that's what I want.



      I'm aware that it's possible to restrict the users that appear in the list via polkit rules but my naive understanding of those rules is they change who is allowed to authenticate for certain actions, and that this behaviour is instead in the realm of the polkit GUI agent. Or am I wrong and that the default selection is something that can be set via polkit rules?



      To reiterate I don't wish to change which users/groups are allowed to authenticate to perform polkit actions but just make the UI a little quicker to move through with minimum keypresses and definitely no rodents.



      * I fully acknowledge that this might be the most sensible behaviour for most deployments, but for me its awkward.










      share|improve this question














      Does anyone know how to configure polkit-gnome-authentication-agent-1 to default to the current user initially when handling a request, or alternatively if one of the other polkit agents has this ability?





      When authenticating to perform a polkit action with an agent like polkit-gnome-authentication-agent-1, because I have multiple users in the wheel group I'm provided a drop down to select which user to authenticate as.



      This is an irritating extra step, when in most cases the user I want to authenticate as, is the currently logged in user*. My preferred behaviour is that the currently logged in user is pre-selected and I'm taken straight to password entry, with the option to change to another user if that's what I want.



      I'm aware that it's possible to restrict the users that appear in the list via polkit rules but my naive understanding of those rules is they change who is allowed to authenticate for certain actions, and that this behaviour is instead in the realm of the polkit GUI agent. Or am I wrong and that the default selection is something that can be set via polkit rules?



      To reiterate I don't wish to change which users/groups are allowed to authenticate to perform polkit actions but just make the UI a little quicker to move through with minimum keypresses and definitely no rodents.



      * I fully acknowledge that this might be the most sensible behaviour for most deployments, but for me its awkward.







      linux gnome authentication






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 8 '18 at 20:02









      Chris ScutcherChris Scutcher

      1063




      1063






















          1 Answer
          1






          active

          oldest

          votes


















          1














          The way I managed to solve this issue is by adding a custom file to /etc/polkit-1/rules.d/ named 00-custom.rules with the following lines, to override the 50-default.rules:



          polkit.addAdminRule(function(action, subject) {
          if( subject.isInGroup("wheel") ) {
          return ["unix-user:"+subject.user];
          }
          else {
          return [polkit.Result.NO];
          }
          });


          This way the current user, if present in the wheel group, will be prompted for their password, otherwise for the root password.






          share|improve this answer
























          • I'll give it a shot. Thanks.

            – Chris Scutcher
            Jan 13 at 13:33











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1312042%2fis-there-a-way-to-make-the-polkit-agent-default-to-the-currently-logged-in-user%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          The way I managed to solve this issue is by adding a custom file to /etc/polkit-1/rules.d/ named 00-custom.rules with the following lines, to override the 50-default.rules:



          polkit.addAdminRule(function(action, subject) {
          if( subject.isInGroup("wheel") ) {
          return ["unix-user:"+subject.user];
          }
          else {
          return [polkit.Result.NO];
          }
          });


          This way the current user, if present in the wheel group, will be prompted for their password, otherwise for the root password.






          share|improve this answer
























          • I'll give it a shot. Thanks.

            – Chris Scutcher
            Jan 13 at 13:33
















          1














          The way I managed to solve this issue is by adding a custom file to /etc/polkit-1/rules.d/ named 00-custom.rules with the following lines, to override the 50-default.rules:



          polkit.addAdminRule(function(action, subject) {
          if( subject.isInGroup("wheel") ) {
          return ["unix-user:"+subject.user];
          }
          else {
          return [polkit.Result.NO];
          }
          });


          This way the current user, if present in the wheel group, will be prompted for their password, otherwise for the root password.






          share|improve this answer
























          • I'll give it a shot. Thanks.

            – Chris Scutcher
            Jan 13 at 13:33














          1












          1








          1







          The way I managed to solve this issue is by adding a custom file to /etc/polkit-1/rules.d/ named 00-custom.rules with the following lines, to override the 50-default.rules:



          polkit.addAdminRule(function(action, subject) {
          if( subject.isInGroup("wheel") ) {
          return ["unix-user:"+subject.user];
          }
          else {
          return [polkit.Result.NO];
          }
          });


          This way the current user, if present in the wheel group, will be prompted for their password, otherwise for the root password.






          share|improve this answer













          The way I managed to solve this issue is by adding a custom file to /etc/polkit-1/rules.d/ named 00-custom.rules with the following lines, to override the 50-default.rules:



          polkit.addAdminRule(function(action, subject) {
          if( subject.isInGroup("wheel") ) {
          return ["unix-user:"+subject.user];
          }
          else {
          return [polkit.Result.NO];
          }
          });


          This way the current user, if present in the wheel group, will be prompted for their password, otherwise for the root password.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 9 at 16:33









          nicolo.rebughininicolo.rebughini

          111




          111













          • I'll give it a shot. Thanks.

            – Chris Scutcher
            Jan 13 at 13:33



















          • I'll give it a shot. Thanks.

            – Chris Scutcher
            Jan 13 at 13:33

















          I'll give it a shot. Thanks.

          – Chris Scutcher
          Jan 13 at 13:33





          I'll give it a shot. Thanks.

          – Chris Scutcher
          Jan 13 at 13:33


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1312042%2fis-there-a-way-to-make-the-polkit-agent-default-to-the-currently-logged-in-user%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Probability when a professor distributes a quiz and homework assignment to a class of n students.

          Aardman Animations

          Are they similar matrix