How to allow password authentication OR key authentication on CentOS 5.7?

21,026

Solution 1

Disabling PasswordAuthentication doesn't force keys, it disables password authentication, as advertised.

PubkeyAuthentication determines whether key authentication is allowed.

So, to answer your question directly, the following config allows either password or key auth:

PasswordAuthentication yes
PubkeyAuthentication yes

Solution 2

Do you mean you want something like this:

Match User user1
    PasswordAuthentication no
    RSAAuthentication yes
    PubkeyAuthentication yes

Match User user2
    PasswordAuthentication yes
    RSAAuthentication no
    PubkeyAuthentication no
Share:
21,026

Related videos on Youtube

Darren
Author by

Darren

Currently developing with Java, React Redux (JavaScript), and Oracle. In the past I've developed with NodeJS, PHP, MySQL, PostgreSQL, Redis, Memcached, and Angular. I'm pretty nifty implementing clients from the backend controller layer to the JavaScript/HTML/CSS frontend layer.

Updated on September 18, 2022

Comments

  • Darren
    Darren almost 2 years

    is it possible to enable the use of password authentication or key authentication in CentOS 5.7? All I can find is setting PasswordAuthentication to no which forces the use of keys...

    Thanks

  • Timo
    Timo over 5 years
    Where put the content for ? Is it in ssh_config?
  • Davuz
    Davuz over 5 years
    Place this configuration at the end of ssh_config
  • Khom Nazid
    Khom Nazid over 3 years
    Is there a way to do this for root (user1), but the other config for "everyone else"? How does one write "everyone else" in place of user2?