ファイルの説明 - org.freedesktop.login1.policy

ファイルの説明 - org.freedesktop.login1.policy

Ubuntu 16.04を使用しています。

/usr/share/polkit-1/actions/org.freedesktop.login1.policyシャットダウン/一時停止/休止状態オプションに関連する権限を制御するように見えるファイルがあります。

このファイルの関連オプションの形式は次のとおりです。

<defaults>
  <allow_any>no</allow_any>
  <allow_inactive>auth_admin_keep</allow_inactive>
  <allow_active>yes</allow_active>
</defaults>

各タスク(閉じる、一時停止など)に対応します。
ここファイルのフルバージョンです。

allow_anyallow_inactiveそしてオプションが何を意味するのか知りたいですallow_active
どういう意味ですか?

私が気になった理由は、ルートなしで非対話式(クローンから)で休止状態に切り替えたいのですが承認エラー

このファイルを修正すると、これらのエラーを解決できるようです。

ベストアンサー1

このリンク次の情報が含まれています。もう一つの答えより良い方法で。

特にこの部分は:

デフォルトのラベルは、権限または権限の欠如がある場所です。これには、および
の3つの設定が含まれています。非アクティブセッションは通常リモートセッション(SSH、VNCなど)ですが、アクティブセッションはTTYまたはXモニタを介してコンピュータに直接書き込まれます。両方の状況を扱う設定です。allow_anyallow_inactiveallow_active

allow_any

各設定には次のオプションがあります。

no: The user is not authorized to carry out the action. There is therefore no need for authentication.
yes: The user is authorized to carry out the action without any authentication.
auth_self: Authentication is required but the user need not be an administrative user.
auth_admin: Authentication as an administrative user is require.
auth_self_keep: The same as auth_self but, like sudo, the authorization lasts a few minutes.
auth_admin_keep: The same as auth_admin but, like sudo, the authorization lasts a few minutes.

返品、ここpolkitの公式マニュアルページです。

タスクとtoの下のタグを変更して、nocronで休止状態をオンにすることができます。yesallow_anyorg.freedesktop.login1.hibernateorg.freedesktop.login1.hibernate-multiple-sessions

ただし、これは推奨される回避策ではありません。将来のアップグレード中に削除される可能性があるためです。

代わりに、次の内容を含むファイルを生成できます。

[Enable hibernate to be run via cron]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.hibernate-multiple-sessions
ResultAny=yes 

com.0.enable-hibernation-from-cron.pklaディレクトリ名を指定すると/etc/polkit-1/localauthority/50-local.d/同じ効果が得られます。

visudoより良い解決策を提示しましたここ

おすすめ記事