I have set up an SSH server to accept only login using codes generated by Google Authenticator (I have disabled all other forms of authentication on that port). After having rebooted my remote machine, it keeps giving me the Access Denied
error after having entered the code on the authenticator app. It has been working flawlessly up till now (i.e. before the reboot).
So far, I've logged in using a scratch code (which it accepts), and have tried generating a new secret and scanning this new QR code with the Google Authenticator app and testing it using another terminal, all to no avail. I have also tried deleting the libpam-google-authenticator module and reinstalling it, generating another code and trying to login again from another terminal. This also didn't work. What could possibly be going wrong?
1 Answer
Like @user2313067 pointed, this problem is happening probably because the clock of your server is with wrong time.
Google Authenticator is an implementation of OTP (One-time password) and it is based on a private seed and on time to check if the code you are entering is correct.
-
This is the correct answer, however, it was posted in a comment to the question almost 6 months ago by @user2313067. You could have at least given him/her credit for the correct answer. Commented Nov 27, 2014 at 10:24
-
@ChrisMurray I am sorry, I am new here and I am trying to help, so I answered a lot of questions yesterday and I didn't see the user2313067 answer. Updating my answer right now. Thanks and sorry again.– Lucas NNCommented Nov 28, 2014 at 1:52
-
ntpd -qg
, it worked again like a charm!!