enable both password and key file to ssh logon in ?

Posted February 17, 2015 9.3k views

one vps server and two client machine.
Can i set the vps server to be logon in via password on machine 1 at the same time to be logon in via key file on machine 2?

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.

2 answers

Yes, that’s the default setting actually. Just set up an SSH key for your user and when you connect to your droplet without an ssh key (machine 2) it will fall back to a password prompt.

by Etel Sverdlov
SSH keys provide a more secure way of logging into a virtual private server with SSH than using a password alone. With SSH keys, users can log into a server without a password. This tutorial explains how to generate, use, and upload an SSH Key Pair.

This doesn’t seem to be true anymore (no fallback to password). I also can’t find a setting. Am I missing something?

  • Same here. Doesn’t fallback to password mode for me either.

    • What you have to do is edit the /etc/ssh/sshd_config file and provide PasswordAuthentication with a value of Yes.

      $ sudo vim /etc/ssh/sshd_config


      PasswordAuthentication no
      press i for insert mode

      Change to:

      PasswordAuthentication yes

      Save and Close

      [escape] :wq

      Restart Your SSH

      $ sudo systemctl restart ssh
      Some systems make require
      $ sudo systemctl restart sshd
Submit an Answer