Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

13.7. パーティション再設定のロック

polkit を使用すると、個別の操作のパーミッションを設定できます。udisks2 の場合、ディスク管理サービスのユーティリティーは、/usr/share/polkit-1/actions/org.freedesktop.udisks2.policy にあります。このファイルには、システム管理者が上書きできる操作およびデフォルト値のセットが含まれます。
重要
/etc に保存される polkit 設定は、/usr/share/ のパッケージで提供される設定を上書きすることに注意してください。

手順13.7 ユーザーによるディスク設定の変更を回避する

  1. /usr/share/polkit-1/actions/org.freedesktop.udisks2.policy と同じ内容のファイルを作成します。
    cp /usr/share/polkit-1/actions/org.freedesktop.udisks2.policy /etc/share/polkit-1/actions/org.freedesktop.udisks2.policy
    /usr/share/polkit-1/actions/org.freedesktop.udisks2.policy ファイルは変更しないでください。 変更は次のパッケージの更新によって上書きされます。
  2. 不要なアクションを削除し、以下の行を /etc/polkit-1/actions/org.freedesktop.udisks2.policy ファイルに追加します
      <action id="org_freedesktop_udisks2_modify-device">
         <message>Authentication is required to modify the disks settings</message>
        <defaults>
          <allow_any>no</allow_any>
          <allow_inactive>no</allow_inactive>
          <allow_active>yes</allow_active>
        </defaults>
      </action>
    
    root ユーザーのみがこの操作を実行できるようにする必要がある場合は、noauth_admin に置き換えます。
  3. 変更を保存します。
ユーザーがディスク設定を変更しようとすると、以下のメッセージが返されます。
Authentication is required to modify the disks settings