A bit strange behavior: I have two accounts on my Fedora install and sometimes I use both at the same time and switch between both with [CTRL]+[ALT]+[F1], [CTRL]+[ALT]+[F2], and [CTRL]+[ALT]+[F3].
Sometimes after switching it asks for a password with the reason:
Legitimierung wird benötigt, um Metadaten zu aktualisieren
GNOME Software does automatic updates in the background for the system using rpm-ostree and that requires permissions, which are asked via polkit, which opens this dialog.
This also may be an issue. It puts the username into a file named for the user that is located in /etc/sudoers.d/
That means if the user is part of the wheel group the entry for the wheel group in /etc/sudoers may have effect, or may be conflicted with the username entry in the file just created. Which takes effect may be determined by the order in which the sudo command checks for username permissions versus group permissions.
If the user is part of the wheel group and no other users are allowed to use sudo without passwords that line probably should read %wheel ALL=(ALL) NOPASSWD: ALL
which is already shown in /etc/sudoers as an example alternate to the default %wheel ALL=(ALL) ALL
Note that (for the way you made that entry) if the NOPASSWD is not set for the wheel group and the group permissions are checked first then a password would be required. If the username permissions are checked first then the password would not be required.
What I did was make the file /etc/sudoers/wheel-nopasswd with the content %wheel ALL=(ALL) NOPASSWD: ALL and it works very well for members of the wheel group.
If the user is unprivileged (not part of the wheel group) then your polkit policy does not apply to them.
OK, but this is not the case. I checked /etc/group and also sudo works without password.
@computersavvy Interesting. I have to think about that and read a bit more. But, as I just stated, sudo works without password, so I think my current configuration is fine. I will look into your improvement suggestions, though.
However please keep in mind that my main question is: Why do I get this password-prompt when switching sessions?
The drop -in just works if you have the second line below in the /etc/sudoers file.
And probably you just made the changes there in the old fassion sudoers file.
/etc/sudoers
...
#Read drop-in files from /etc/sudoers.d (the # here does not mean a comment)
#includedir /etc/sudoers.d
I deleted /var/lib/polkit-1/localauthority/50-local.d/disable-passwords.pkla and added a file named /etc/polkit-1/rules.d/49-nopasswd_global.rules with this content:
/* Allow members of the wheel group to execute any actions
* without password authentication, similar to "sudo NOPASSWD:"
*/
polkit.addRule(function(action, subject) {
if (subject.isInGroup("wheel")) {
return polkit.Result.YES;
}
});