I configured ssh to using keys files situated in ~/.ssh
to login. Now I'd like to install a two factor authentication when using password, but not required when using key files. I've seen how to install two factor authentication here: DigitalOcean: How To Protect SSH With Two-Factor Authentication.
But it applies for both keys logins and password login, I'd like to use it only for password login.
I'd like:
- public-key -> ok to enter server
or
- password -> one-time password -> ok to enter server
Maybe it is possible to do something with the AuthenticationMethods
in sshd_config
? I've found this: OpenSSH use (public key or password) + google authenticator