How do I keep a password login enabled for SFTP transactions (made by Drupal, if this is important) while keeping it disabled for all other SSH key based authentications? Currently all the existing users of the CentOS server use keys to log in and /etc/ssh/sshd_config has PasswordAuthentication no
)?
From what I gather you want to permit passwords from some users, but not others?
You could setup a
Match
block. So your config might look something like below.Since you mentioned these password-based transactions are happening from drupal, perhaps you could whitelist based on the host address?
Match address 127.0.0.1/32
You should even be able to combine the criteria, and say only a specific account from a specific address can do password authentication.
Links
The SFTP is just a specific case of SSH session. Password login is enabled by default, if you have
PasswordAuthentication yes
orChallengeResponseAuthentication yes
in your/etc/ssh/sshd_config
. Allowing password authentication does not block the key based authentication.Head over to the file /etc/ssh/sshd_config, and change the following line :
Then restart sshd :