ERROR: sudo: pam_open_session: System error sudo: policy plugin failed session initialization

I got this error when trying to run a few commads with sudo right after I set password expiration on my RHEL7 box. Immediately after, I couldn’t use sudo for any commands… This how I got to resolve it.

sudo: pam_open_session: System error
sudo: policy plugin failed session initialization

I realised the issue comes from password expiration. The moment I set my expiration period as 20 days, it seems to have immediately expired my password – perhaps because its been over 90 days since I installed my OS and I have never changed the password.

To resolve this, I simply changed the password usng passwd command

[[email protected] Downloads]$ passwd
 Changing password for user wm.
 Changing password for wm.
 (current) UNIX password: 
 New password: 
 Retype new password: 
 passwd: all authentication tokens updated successfully.

After that, I could now run my commands in sudo normally.

Leave a Reply

Your email address will not be published. Required fields are marked *