[印刷設定]ダイアログボックスで、admin / sudoパスワード要求を停止します。

[印刷設定]ダイアログボックスで、admin / sudoパスワード要求を停止します。

私はCinnamonと一緒にManjaroを使用していますが、印刷設定(情報)に入るたびにsystem-config-printerパスワードを入力する必要がある角の「ロック解除」をクリックするまでは何もできません。

これは迷惑であり、認証は数分後に期限切れになるため、繰り返しロックを解除する必要があります。

すべての機能にパスワードなしでアクセスできるようにするにはsystem-config-printer?私のユーザーをグループに追加しましたcupsprinter私のシステムにはグループがありません。

このマシンは自分だけのために家にあり、すでに安全であり、プリンタの設定への不正アクセスを心配する必要はありません。

ベストアンサー1

さて、あなたの質問はまだ2つの部分に分かれているので、それを分割して各質問に個別に答えます。

1. CUPSポリシーとアクセス

CUPSはLinuxの事実上のプリントサーバーで、USBケーブルの直接接続、ローカルLAN印刷、WANアクセスなど、あらゆる種類の印刷を可能にします。したがって、これにはさまざまな構成設定があり、その多くはセキュリティとシステムポリシーの管理に関連しています。現在の主な目標は、基本的にパスワードを入力せずに所有およびアクセス可能なローカル(直接接続またはLAN)プリンタに印刷できるようにすることであるため、この時点でこれらの複雑な詳細を詳しく調べることは非生産的です。 。

これをインストールして(現在のほとんどのLinuxディストリビューションに含まれている)サービスを開始した場合cups(マシンが表示されている場合はsystem-print-settingsすでに実行中です):

sudo systemctl start cups

だからあなたが行くならhttp://localhost:631//etc/cups/cupsd.confデフォルトでは、アクセスに制限のないCUPS設定用のWebアクセス可能なGUIであるCUPSサーバー管理ページが表示されます。

[...]
Browsing On
BrowseLocalProtocols dnssd
DefaultAuthType Basic
WebInterface Yes
<Location />
  # Restrict access to the server...
  Order allow,deny
</Location>
[...]

同じファイルをさらに詳しく見ると、次のようなcupsd.conf他の場所が制限されていることがわかります。

<Location /admin/conf>
  AuthType Default
  Require user @SYSTEM
</Location>

パスワードを入力すると、パスワードの入力をhttp://localhost:631/admin/conf求められます。

今最も重要な部分は次のとおりです。CUPSは考慮されません。 rootまたはsudo**何らかの方法で特別でなければなりません。サーバー構成へのアクセスを許可するグループに属するという事実**

@SYSTEMの仕様/etc/cups/cupsd.confはにある値への参照です/etc/cups/cups-files.conf。通常、管理者が直接変更しない限り、次のようになります。

sudo grep -i System /etc/cups/cups-files.conf 
# Administrator user group, used to match @SYSTEM in cupsd.conf policy rules...
SystemGroup lpadmin

lpadminこのグループは、ユーザーが含むCUPSを設定できるようにシステムに存在しますroot。 rootとして実行している場合は、そのグループがに含まれていることがgroupsわかります。lpadminroot

したがって、すべてのシステムユーザーがCUPS構成ページにアクセスできるようにするには、そのユーザーがlpadmin見つけたそのグループ名の一部か他のグループ名の一部であることを確認する必要があります。@SYSTEMcups-files.conf

明らかに、グループにユーザーを追加した後、サービスcupsとユーザーセッションを再開する必要があるかもしれないので、再起動することをお勧めします。

これで、sudoを使用していないユーザーもプリンタオプションを設定、印刷、および自分が所有しているプリンタにジョブを転送/キャンセルできます。の他のデフォルト設定はcupsd.conf基本的に十分に安全でなければなりません。それとも、少なくとも私が最後に聞いたことです。

2Print Settingssystem-config-printer

上記の方法を使用すると、http://localhost:631/*root以外のユーザーとしてプリンタ設定オプションにアクセスできますが、そのユーザーがそのグループに属している間はまだパスワードの入力を求められますlpadmin。を及ぼさないということです。system-config-printerDialog関連コンテンツに。

今、この部分がはるかに難しいことを認めます。sudoersさまざまな形式のアクセスを許可するsudo以外のユーザーのグループ権限を使用すると、後でダイアログボックスを開くたびにパスワードプロンプトが表示されます。たとえば、設定をクリックするとパスワードのプロンプトが表示されます。バックグラウンドにそのままにすると、最終的に設定ダイアログボックスが開き、ほとんどの設定オプションを変更することができないか、非常に非現実的であることが判明しました。

次に、そのダイアログボックスのポリシー設定を管理する方法を調べて、そのファイルを見つけました。

必要なのは次のコード行です。gawk(ランタイムは内部交換用にインストールされていることを確認します)unlock以下を実行すると、ボタンやパスワードのプロンプトは表示されませんsystem-config-printer

sudo gawk -i inplace '{gsub((/auth_admin|auth_admin_keep/),"yes"); print }' /usr/share/polkit-1/actions/org.opensuse.cupspkhelper.mechanism.policy 

それがすることは、そのダイアログボックスのポリシーファイルに必要なすべての値を変更することですauth_admin。したがって、ポリシーファイルに次の設定が適用され、アクセスレベルが変更されます。auth_admin_keepyes

$ sudo grep -e "action id" -e  "description xml:lang=\"en\"" -e "yes" /usr/share/polkit-1/actions/org.opensuse.cupspkhelper.mechanism.policy


 <action id="org.opensuse.cupspkhelper.mechanism.server-settings">
    <description xml:lang="en">Get/Set server settings</description>
      <allow_any>yes</allow_any>
      <allow_inactive>yes</allow_inactive>
      <allow_active>yes</allow_active>
  <action id="org.opensuse.cupspkhelper.mechanism.devices-get">
    <description xml:lang="en">Get list of available devices</description>
      <allow_any>yes</allow_any>
      <allow_inactive>yes</allow_inactive>
      <allow_active>yes</allow_active>
  <action id="org.opensuse.cupspkhelper.mechanism.printer-set-default">
    <description xml:lang="en">Set a printer as default printer</description>
      <allow_any>yes</allow_any>
      <allow_inactive>yes</allow_inactive>
      <allow_active>yes</allow_active>
  <action id="org.opensuse.cupspkhelper.mechanism.printer-enable">
    <description xml:lang="en">Enable/Disable a printer</description>
      <allow_any>yes</allow_any>
      <allow_inactive>yes</allow_inactive>
      <allow_active>yes</allow_active>
  <action id="org.opensuse.cupspkhelper.mechanism.printer-local-edit">
    <description xml:lang="en">Add/Remove/Edit a local printer</description>
      <allow_any>yes</allow_any>
      <allow_inactive>yes</allow_inactive>
      <allow_active>yes</allow_active>
  <action id="org.opensuse.cupspkhelper.mechanism.printer-remote-edit">
    <description xml:lang="en">Add/Remove/Edit a remote printer</description>
      <allow_any>yes</allow_any>
      <allow_inactive>yes</allow_inactive>
      <allow_active>yes</allow_active>
  <action id="org.opensuse.cupspkhelper.mechanism.class-edit">
    <description xml:lang="en">Add/Remove/Edit a class</description>
      <allow_any>yes</allow_any>
      <allow_inactive>yes</allow_inactive>
      <allow_active>yes</allow_active>
  <action id="org.opensuse.cupspkhelper.mechanism.job-edit">
    <description xml:lang="en">Restart/Cancel/Edit a job</description>
      <allow_any>yes</allow_any>
      <allow_inactive>yes</allow_inactive>
      <allow_active>yes</allow_active>
  <action id="org.opensuse.cupspkhelper.mechanism.job-not-owned-edit">
    <description xml:lang="en">Restart/Cancel/Edit a job owned by another user</description>
      <allow_any>yes</allow_any>
      <allow_inactive>yes</allow_inactive>
      <allow_active>yes</allow_active>
  <action id="org.opensuse.cupspkhelper.mechanism.all-edit">
    <description xml:lang="en">Change printer settings</description>
      <allow_any>yes</allow_any>
      <allow_inactive>yes</allow_inactive>
      <allow_active>yes</allow_active>
  <action id="org.opensuse.cupspkhelper.mechanism.printeraddremove">
    <description xml:lang="en">Add/Remove/Edit a printer</description>
      <allow_any>yes</allow_any>
      <allow_inactive>yes</allow_inactive>
      <allow_active>yes</allow_active>

これで、Part 1で作成したものからアクセスが許可されていない場合、Part 2でポリシー設定を変更してもCUPSには影響しません。実際にこのダイアログボックスにアクセスするcupsと、実行されていないか、アクセスが制限されている(ルートから追い出されても)lpadmin印刷できません。

おすすめ記事