SSHパスワードベースのログインが失敗するのはなぜですか?

SSHパスワードベースのログインが失敗するのはなぜですか?

現在のSSHキーを使用してサーバー(Ubuntu 18.04)に接続します。 (特定の制限された範囲内で)パスワードを使用してログインする機能を許可したいと思います。

試行するたびにパスワードが失敗します。以下は、パスワードを設定した後に使用しようとしているセッションです。

~ # id
uid=0(root) gid=0(root) groups=0(root)

~ # passwd
Enter new UNIX password: <helloworld>
Retype new UNIX password: <helloworld>
passwd: password updated successfully

~ # ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no [email protected]
The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
ECDSA key fingerprint is SHA256:AlFtwpK4EhhaMXP5aT6fuQM9u9RYPq/o/sLJXfz++jM.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '127.0.0.1' (ECDSA) to the list of known hosts.
[email protected]'s password: <helloworld>
Permission denied, please try again.

これが明白であればお詫び申し上げます。サーバーがなぜ新しいパスワードを受け入れてから、パスワードベースのログインを受け入れ、最後に資格情報を拒否するのかわかりません。

編集:sshd_configファイルの追加に失敗しました。

~ # cat /etc/ssh/sshd_config | grep -v ^#  | grep -v ^$                                                                                                                  root@srv
Port 22
PasswordAuthentication no
ChallengeResponseAuthentication no
GSSAPIAuthentication no
UsePAM yes
PrintMotd no
UseDNS no
AcceptEnv LANG LC_*
Subsystem       sftp    /usr/lib/openssh/sftp-server
Match Address 192.168.10.0/24,192.168.20.0/24,127.0.0.0/8
    PasswordAuthentication yes

ベストアンサー1

PermitRootLogin設定がないため、ログインに失敗します。/etc/ssh/sshd_configデフォルトはprohibit-passwordパスワードログインの無効化ですroot

次へ追加

PermitRootLogin yes

ブロックすると、パスワードまたは公開鍵認証を使用したログインがMatch許可されます。root

別のオプションは、他のユーザーを使用することです。

おすすめ記事