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?

  • Public key authentication want enough eh? :P
    – user36976
    Jun 2, 2014 at 11:09
  • @Nick: PubKeys force me to stick to 1 computer, but I have to be more mobile (I sometimes use computers at work). Keys are great, as long as you're happy to carry around a key-holder :-)
    – Brill
    Jun 2, 2014 at 11:13
  • 7
    Is the server's time correct? Jun 2, 2014 at 22:07
  • @user2313067: Good point...I checked and it was waaaay off. After correcting that using ntpd -qg, it worked again like a charm!!
    – Brill
    Jun 3, 2014 at 8:07

1 Answer 1


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. 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 NN
    Nov 28, 2014 at 1:52
  • @ChrisMurray Done!
    – Lucas NN
    Nov 28, 2014 at 1:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .