By albertSquid
After following the “How To Set Up Multi-Factor Authentication for SSH” guide (https://www.digitalocean.com/community/tutorials/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04), all users get the Further authentication required / keyboard-interactive message from the server when logging in - also users that doesn’t have multi-factor active.
This messes with the PHP library I use to make SSH connections, phpseclib, as it expects to be prompted for multi-factor, but it actually doesn’t.
Connecting through something like PuTTY, it works just fine; it does note that “Further authentication is required”, but it just ignores it and successfully logs in - I’m just not that lucky with the mentioned library.
I did follow Step 7 in the mentioned guide, but it still seems like it prompts somehow…
Does anyone know how to make the server not send the keyboard-interactive message to the client, when it’s indeed not needed?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Heya,
If you’re encountering issues with keyboard-interactive authentication while using the phpseclib library, it might be helpful to try configuring the SSH server to avoid prompting for multi-factor authentication if it’s not required for certain users.
You can create a specific Match User block within the /etc/ssh/sshd_config file to specify conditions for the users who will NOT use MFA:
- Match User user1,user2
- AuthenticationMethods publickey
Make sure to replace user1 and user2 with the actual usernames of the non-MFA users. This configuration will require only public key authentication for the specified users, skipping the keyboard-interactive message you mentioned.
After editing the configuration, don’t forget to restart the SSH service:
- sudo systemctl restart ssh
For more details on SSH server configuration, you can refer to this DigitalOcean tutorial.
Hope that this helps!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.
