sshd_config 内の "PasswordAuthentication" 等のパラメタの変更が再起動で失われる
search cancel

sshd_config 内の "PasswordAuthentication" 等のパラメタの変更が再起動で失われる

book

Article ID: 434021

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

免責事項:これは英文の記事 「Modifying the parameters like "PasswordAuthentication" to yes in sshd_config are not persistent across reboot」の日本語訳です。記事はベストエフォートで翻訳を進めているため、ローカライズ化コンテンツは最新情報ではない可能性があります。最新情報は英語版の記事で参照してください。

"PasswordAuthentication" のデフォルトの値は通常、"yes" です。

  1. この設定はユーザまたはシステムが SSH にてパスワード認証で接続しようとした際に、アクセスを許可または拒否するために使用します。

Environment

VMware vSphere ESXi 8.0.1 以前

Cause

sshd_config ファイルを直接変更した場合、その変更内容は再起動で失われます。

Resolution

  1. SSH で ESXi ホストへ接続して root でログインします。
  2. 下記の一行を /etc/rc.local.d/local.sh ファイルへ追記し、sshd_config ファイル内の "PasswordAuthentication" のエントリが再起動で失われないようにします。

    sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config

  3. /etc/rc.local.d/local.sh ファイルは下記のようになります:

    !/bin/sh ++group=host/vim/vmvisor/boot# local configuration options.   Note: modify at your own risk!  If you do/use anything in this
    # script that is not part of a stable API (relying on files to be in
    # specific places, specific tools, specific output, etc) there is a
    # possibility you will end up with a broken system after patching or
    # upgrading.  Changes are not supported unless under direction of
    # VMware support.# Note: This script will not be run when UEFI secure boot is enabled.
    sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
    exit 0

  4. ESXi ホストを再起動します。

注: ESXi 8.0.2 以降では /etc/ssh/sshd_config を直接変更することはサポートされません。サポートされる変更方法は Configurable properties of SSH Server on ESXi 8.0.2 or later を参照してください。

Additional Information