Question

Change SSH Keys Auth to Password Auth

I created a droplet with SSH keys authentication. However, I want to change this to accept password authentication. I have changed the sshd_config to allow this but the ssh service still only seems to accept keys.


Submit an answer


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!

Sign In or Sign Up to Answer

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.

KFSys
Site Moderator
Site Moderator badge
November 9, 2024

Heya,

There are typically a few things you need to check, first is if you made the change properly in your /etc/ssh/sshd_config. Make sure that there isn’t a typo on the line -

PasswordAuthentication yes

Make sure to restart the sshd service afterward as well service sshd restart

If you are still experiencing the same outcome, check your ssh folder and configs if there aren’t any other options that could be preventing you from continuing.

alexdo
Site Moderator
Site Moderator badge
November 8, 2024

Heya, @77a8c39df5da495389dbc5a28f3436

On some systems, SELinux or other security frameworks may interfere with the SSH configuration changes. You can check the current SELinux status with:

getenforce

If it’s set to Enforcing, try temporarily switching it to Permissive with:

sudo setenforce Permissive

Then test the SSH connection again.

If you still can’t log in with a password, check /var/log/auth.log (on Ubuntu) or /var/log/secure (on CentOS) for messages that might give a clue about why the password login is failing.

Regards

Bobby Iliev
Site Moderator
Site Moderator badge
November 7, 2024

Hey there!

To enable password authentication on your Droplet, make sure you’ve configured the SSH settings correctly. Can you confirm that you’ve updated the /etc/ssh/sshd_config file and not the /etc/ssh/ssh_config file? The former is the server-side configuration file, while the latter is the client-side configuration file.

  • Open the SSH configuration file on your Droplet:
    sudo nano /etc/ssh/sshd_config
    
  • Look for these lines and set them as follows:
    PasswordAuthentication yes
    

Also, after making the changes, save and close the file, then restart SSH for the changes to take effect:

sudo systemctl restart ssh

Let me know if that gets things working for you!

- Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.