答案1
/var/log/auth.log
所有此类请求都以类似的格式记录(polkitd
其中的任何内容都应与这些形式的身份验证请求相关):
Apr 23 17:45:09 tester-VirtualBox polkitd(authority=local): Operator of unix-session:c2 successfully authenticated as unix-user:tester to gain TEMPORARY authorization for action org.debian.apt.install-or-remove-packages for system-bus-name::1.89 [/usr/bin/python3 /usr/bin/gnome-language-selector] (owned by unix-user:tester)
失败的尝试可能是这样的:
Apr 23 18:00:55 tester-VirtualBox polkitd(authority=local): Operator of unix-session:c2 FAILED to authenticate to gain authorization for action org.debian.apt.install-or-remove-packages for system-bus-name::1.91 [/usr/bin/python3 /usr/bin/gnome-language-selector] (owned by unix-user:tester)
因此,如果您希望仅过滤已接受的或已拒绝的,那么您可能需要使用:
cat auth.log | grep "polkitd" | grep "FAILED to authenticate"
或者:cat auth.log | grep "polkitd" | grep "successfully authenticated"
欲了解更多信息,请polkit
参阅man polkit
。