Cannot use sudo, sudo: PAM authentication error: Module is unknown

I had to edit "sudo nano /etc/pam.d/sudo" as I was trying to setup my yubikeys to use to login. I still do not know what the problem is for that but now I cannot use sudo.

sudo: PAM authentication error: Module is unknown
sudo: a password is required

I cannot load "sudo nano /etc/pam.d/sudo" because Terminal wants my password. I was able to access "sudo nano /etc/pam.d/sudo" using "pamu2fcfg > ~/.config/Yubico/u2f_keys". That allowed my access to /etc/pam.d/sudo where I deleted the last entry I made. I followed the Yubico guide and it said to us ctrl+o to save and exit. Problem is that it does not work.

Is there any way to access /etc/pam.d/sudo in such a way that I can save my changes?

Someone else who had the same trouble asked about it on Reddit here:

When you using the command sudo you will allways be asked for a password, you use the password you have set for your user account.
You can not save a config file without using sudo + password

You don't understand my question correctly. If I use sudo for anything, I am prompted for my account password. I will enter in my account password and I will hit enter. Then the PAM authentication error occurs.

I see, yes i misunderstood. I thought you didn't type a password or that you thought you needed another password than user password.

Those instructions are used for when you cannot log in. I can log in, I just cannot use sudo.

It does not say anything at all about being unable to Log In.
It specifies inability to use sudo, just as you described. Logging in is not mentioned by any of the posts.

I am finally able to use sudo---

pkexec vi /etc/pam.d/sudo

delete entry for yubikey

type :w then hit enter, that saves the file.

Close terminal

Open terminal, test sudo.


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.