すべてのプロダクト
Search
ドキュメントセンター

:SSH エラー:「must be owned by root and not group or world-writable」

最終更新日:Jun 21, 2026

このトピックでは、Linux Elastic Compute Service (ECS) インスタンスで SSH サービスを起動する際に「must be owned by root and not group or world-writable」エラーが発生する原因と、その解決方法について説明します。

現象

Linux ECS インスタンスで SSH サービスの起動に失敗します。システムログには、次のようなエラーエントリが記録されています。

May 17 17:31:57 ecs-centos72-test systemd: Failed to start OpenSSH server daemon.
May 17 17:31:57 ecs-centos72-test systemd: Unit sshd.service entered failed state.
May 17 17:31:57 ecs-centos72-test systemd: sshd.service failed.
May 17 17:32:39 ecs-centos72-test systemd: sshd.service holdoff time over, scheduling restart.
May 17 17:32:39 ecs-centos72-test systemd: Starting OpenSSH server daemon...
May 17 17:32:39 ecs-centos72-test sshd: /var/empty/sshd must be owned by root and not group or world-writable.
May 17 17:32:39 ecs-centos72-test systemd: sshd.service: main process exited, code=exited, status=255/n/a
May 17 17:32:39 ecs-centos72-test systemd: Failed to start OpenSSH server daemon.
May 17 17:32:39 ecs-centos72-test systemd: Unit sshd.service entered failed state.
May 17 17:32:39 ecs-centos72-test systemd: sshd.service failed.

原因

セキュリティ上の理由から、SSH サービスでは関連するディレクトリとファイルに特定のパーミッションと所有権が必要です。このエラーは、/var/empty/sshd ディレクトリの所有者またはグループが異なる場合に発生します。

ソリューション

この問題を解決するには、/var/empty/sshd ディレクトリの所有者とグループを修正します。

  1. VNC リモート接続で ECS インスタンスに接続します。

    詳細については、「接続方法の概要」をご参照ください。

  2. 次のコマンドを実行して、/var/empty/sshd ディレクトリのパーミッションを確認します。

    ll /var/empty/

    次の出力は、/var/empty/sshd ディレクトリの所有者が linux ユーザーで、グループが linux であることを示しています。所有者とグループを root に変更する必要があります。

    [xxx@xxx xxx]# ll /var/empty/
    total 4
    drwx--x--x. 2 linux linux 4096 Oct 20  2017 sshd
  3. 次のコマンドを実行して、デフォルトの設定に戻します。

    重要

    この例の chmod コマンドは CentOS 7 に固有のものです。/var/empty/sshd ディレクトリに必要なパーミッションは、Linux ディストリビューションによって異なる場合があります。正しいパーミッションを確認するには、同じ Linux ディストリビューションを実行している別のインスタンスの設定を確認してください。

    chown -R root:root /var/empty/sshd
    chmod -R 711 /var/empty/sshd
  4. 次のコマンドを実行して、SSH サービスを再起動します。

    systemctl restart sshd.service