OpenSSH: требуется аутентификация с открытым ключом для конкретного пользователя

264
Dave

Как я могу настроить свой сервер OpenSSH для аутентификации с открытым ключом для определенного (обычного, не-root) пользователя? Все остальные пользователи могут войти через пароль как обычно.

1

1 ответ на вопрос

4
Attie

Вы можете использовать следующее в /etc/ssh/sshd_config:

Match User attie AuthenticationMethods publickey 

Обратите внимание, что Matchразделы должны быть в конце файла конфигурации ...

Не забудьте перезагрузить SSH сервер:

systemctl reload ssh 

 AuthenticationMethods Specifies the authentication methods that must be successfully completed for a user to be granted access. This option must be followed by one or more comma- separated lists of authentication method names. Successful authentication requires completion of every method in at least one of these lists.  For example, an argument of "publickey,password publickey,keyboard-interactive" would require the user to complete public key authentication, followed by either password or keyboard interactive authentication. Only methods that are next in one or more lists are offered at each stage, so for this example, it would not be possible to attempt password or keyboard-interactive authentication before public key. 
Линии соответствия должны появляться в конце sshd_config. Dave 6 лет назад 1
Спасибо, я добавил это к моему ответу для полноты Attie 6 лет назад 0

Похожие вопросы