Question

Can both password authentication and an SSH key be used on the same account at Digital Ocean?

We have a user who has an issue using an SSH key and would prefer to keep using a username and password to log in.


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.

jarland
DigitalOcean Employee
DigitalOcean Employee badge
• August 6, 2018
Accepted Answer

Hello friend!

Absolutely. You will need to make sure that “AllowRootLogin” is set to yes in /etc/ssh/sshd_config, then restart the SSH service if you had to change that. Be sure to work hard on that password, as merely existing with SSH accessible means as many as thousands of attempted logins by attackers every hour.

Kind Regards, Jarland

The general answer is Yes. You can have both SSH key and password authentication on your Ubuntu server.

You will need to create SSH keys for each user and turn PasswordAuthentication to yes on your SSH configuration file:

$ sudo nano /etc/ssh/sshd_config

Then:

$ PasswordAuthentication yes

Press **CTRL +X, Y **and Enter to save the file.

Then restart SSH using the command below:

$ sudo service ssh restart

Try DigitalOcean for free

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

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

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

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more