Thursday, May 2, 2024
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 2898  / 3 Years ago, wed, july 7, 2021, 4:41:18

  • The problem is happening on a remote server, so everything is done through ssh.

  • I can login with my key, no problem here.

  • I can change my password at will with passwd (which I believe shows that it's the correct password for my user).

  • My user is in the sudoers file (I could check with pkexec cat /etc/sudoers and entering the root password)



However, being logged in as my regular user, I can't run sudo commands anymore, it just says Sorry, try again as if the password was mistyped.



I have no clue what causes that, I've tried changing my password, which I could, but it doesn't solve the sudo problem.



$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.10
Release: 12.10
Codename: quantal

More From » command-line

 Answers
7

Ok, fixed it, but I don't really know what caused it in the first place.



The issue was from a line in /etc/pam.d/common-session-noninteractive



It had



session [success=1 default=ignore] pam_succeed_if.so service in cron 
quiet use_uid


And it appears that having this on two lines instead of one was breaking PAM completely.
I just changed it to



session [success=1 default=ignore] pam_succeed_if.so service in cron quiet use_uid


And now everything is back to normal.



I have to thank @AaronD for his comment as it pointed me to investigat PAM, which I found nothing wrong at first (looking at /etc/pam.d/sudo) but when I looked at /var/log/auth.log and noticed all the PAM errors I felt I was digging in the right direction.



The log entry looked like these :



Dec 28 15:43:33 srv12120 sudo: PAM (sudo) illegal module type: quiet
Dec 28 15:43:33 srv12120 sudo: PAM pam_parse: expecting return value; [...use_uid]
Dec 28 15:43:33 srv12120 sudo: PAM (sudo) no module name supplied


A little bit of googling gave me this forum post which gave me the solution highlighted above.


[#27784] Thursday, July 8, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
eanda

Total Points: 439
Total Questions: 116
Total Answers: 105

Location: Armenia
Member since Sat, Dec 31, 2022
1 Year ago
eanda questions
Tue, Nov 22, 22, 15:24, 1 Year ago
Sat, Oct 16, 21, 23:48, 3 Years ago
Sun, Jul 3, 22, 09:38, 2 Years ago
Thu, Feb 3, 22, 14:33, 2 Years ago
;