如何保持密码login启用SFTP事务(由Drupal,如果这是重要的),而保持禁用所有其他基于SSH密钥的身份validation? 目前,CentOS服务器的所有现有用户都使用密钥login,并且/ etc / ssh / sshd_config具有PasswordAuthentication no )?
从我收集你想要允许来自某些用户的密码,而不是其他人?
你可以设置一个Match块。 所以你的configuration可能如下所示。
... PasswordAuthentication no ... Match user drupalsftp PasswordAuthentication yes
既然你提到这些基于密码的交易是从drupal发生的,也许你可以根据主机地址进行白名单? Match address 127.0.0.1/32
你甚至应该能够结合标准,并说只有一个特定的帐户从一个特定的地址可以做密码authentication。
PasswordAuthentication no ... Match user drupalsftp address 10.1.2.3/32 PasswordAuthentication yes # also since we want only sftp ForceCommand internal-sftp
链接
SFTP只是SSH会话的特定情况。 如果您在/etc/ssh/sshd_config具有PasswordAuthentication yes或ChallengeResponseAuthentication yes ,则默认启用密码login。 允许密码authentication不会阻止基于密钥的authentication。