Sie können Folgendes in verwenden /etc/ssh/sshd_config
:
Match User attie AuthenticationMethods publickey
Beachten Sie, dass die Match
Abschnitte am Ende der Konfigurationsdatei sein müssen ...
Vergessen Sie nicht, den SSH-Server neu zu laden:
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.