diff --git a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_user.py b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_user.py index 96b20768bd..ffbe0cefb3 100755 --- a/files/usr/share/cinnamon/cinnamon-settings/modules/cs_user.py +++ b/files/usr/share/cinnamon/cinnamon-settings/modules/cs_user.py @@ -374,13 +374,23 @@ def _on_new_password_icon_released(self, widget, icon_pos, event): def _on_show_password_toggled(self, widget): self.set_passwords_visibility() + def _get_pam_service(self): + import os + if os.path.exists('/etc/pam.d/system-auth'): + return 'system-auth' + elif os.path.exists('/etc/pam.d/common-auth'): + return 'common-auth' + else: + return 'login' + def auth_pam(self): - if not pam.pam().authenticate(GLib.get_user_name(), self.current_password.get_text(), 'passwd'): + service = self._get_pam_service() + if not pam.pam().authenticate(GLib.get_user_name(), self.current_password.get_text(), service): raise PasswordError("Invalid password") def auth_PyPAM(self): auth = PAM.pam() - auth.start('passwd') + auth.start(self._get_pam_service()) auth.set_item(PAM.PAM_USER, GLib.get_user_name()) auth.set_item(PAM.PAM_CONV, self.pam_conv) try: