Google Authenticator Issues w/Linux Mint 19.1

linux
#1

I try to use several tutorials on how to make GA work in Linux Mint 19.1 but when I get to the bottom it says to enter this line and insert it then save an quit while in the pam vim file. Each time I try ESC+:+w+q or :wq and go back an look at the file it is NOT saved…even tried ESC+ZZ to no effect.
The tutorial is located at
https://www.techradar.com/how-to/how-to-add-two-factor-authentication-to-linux-with-google-authenticator

the command …
sudo nano /etc/pam.d/common-auth
takes me to the file that I have to insert…

auth required pam_google_authenticator.so nullok

at the ‘end of the file’ which is very vague on where that exactly is…other posts say to put it just above auth [success=1 default=ignore] pam_unix.so nullok_secure but this post says to go to the ‘END OF THE FILE’ which to me is vague
any help on this I would greatly appreciate as I am doing it for someone else.

0 Likes

#2

Yes, add to the end of file. The file /etc/pam.d/common-auth must already exists.

ls -l /etc/pam.d/common-auth

You can now append it as follows. First login as root:

sudo -i

Now type:

echo 'auth required pam_google_authenticator.so nullok' >> /etc/pam.d/common-auth

Verify it:

cat /etc/pam.d/common-auth

Now you got the line.

0 Likes

#3

I don’t know where the ‘end of the file’ is…have been told that and a specific place to put it BUT when I try to ‘save & exit’ I find it is not there when I retrieve it…or it hasn’t been saved. Saving it I have tried ESC + :wq and ESC +ZZ none seem to save that insert into the pam folder/file thing

0 Likes

#4

where exactly is …this…end of the file ?

0 Likes

#5

to be more precise, when I am in the pam file which line do I insert the command to and how do I save & exit thus making the command insert stay there… ?

0 Likes

#6

Hello Sam,

The first command that the original respondent posted, permitted you to append the text:

To the end of the aforementioned file. So basically you don’t need to open the file just use that command to append that text within the single quotes.
Using the cat command:

Should display the text string at the bottom of the file. Generally, Linux/Unix text files end with a line feed (press enter after the last character on the last line of a text file).

Hope that helps. I’m sure there are more particularly precise ways to describe this. My first answer here. Regards

0 Likes

#7

Thank you so much your commands worked perfectly…the other tutorials used were showing it being placed in different places yours places it at the very end and it works like a charm…thank you so much

0 Likes

#8

Okay guys got it to work but one make that two issues I am experiencing; is now each time I need to put in my password in Linux Mint for any launch of any program it also asks for the Verification Code instead of requiring it for login only.
Another thing is I inadvertently ran the echo thing twice and now have 2 lines at the bottom of the file which in turn asks me for the Verification Code to be entered twice…due to having those 2 lines at the bottom.
I think that in order to have the Verification Code to only ask in login only that it has to be placed in another location other than the bottom of the file.


Attached is a screen shot of the pam folder and where I think the line should be inserted…it is only a guess an that is why I am asking. Then I need to know how to edit the file.
Thanks in advance.

0 Likes

#9

After further review it seems the GA is working properly in that it requires a Verification Code when Administrative privileges are required. That said what I would like to find out is how do I go into this file and take out “auth required pam_google_authenticator.so nullok” as having two iterations of the same command line requires duplicate entries.

0 Likes

#10

Okay I found a way to delete that extra command line in pam.
Had to download the gedit program then run it as root user pointing it to the /etc/pam.d/common-auth file was able to delete and save rebooted an all is good in Mudville…

0 Likes