linux - 杯子取消作业给出禁止的错误

标签 linux printing configuration cups usergroups

我想取消网络打印机上的所有打印作业

cupsenable [printername]
cancel -a [printername]
cancel: purge-jobs failed: Forbidden

用户是“lp”组的成员

我还在/etc/cups/cupsd.conf 文件的限制中添加了@OWNER,其中清除作业和取消作业是

在那之后我关闭了我的 session 并再次尝试,再次出现同样的错误。

之后我明确地添加了我想取消作业的用户

关闭我打开的 session 并再次尝试 -> 没有

也许我遗漏了什么?

这是我的 cupsd.conf:

Listen /var/run/cups/cups.sock
Browsing On
BrowseLocalProtocols dnssd
DefaultAuthType Basic
WebInterface Yes
<Location />
# Allow remote access...
Order allow,deny
Allow all
</Location>
<Location /admin>
</Location>
<Location /admin/conf>
AuthType Default
Require user @SYSTEM
</Location>
<Policy default>
JobPrivateAccess default
JobPrivateValues default
SubscriptionPrivateAccess default
SubscriptionPrivateValues default
<Limit Create-Job Print-Job Print-URI Validate-Job>
Order deny,allow
</Limit>
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs     Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel- Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get- Document>
Require user @OWNER @SYSTEM sonex
Order deny,allow
</Limit>
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class        CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @SYSTEM sonex
Order deny,allow
</Limit>
<Limit Cancel-Job CUPS-Authenticate-Job>
Require user @OWNER @SYSTEM sonex
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>
<Policy authenticated>
JobPrivateAccess default
JobPrivateValues default
SubscriptionPrivateAccess default
SubscriptionPrivateValues default
<Limit Create-Job Print-Job Print-URI Validate-Job>
AuthType Default
Order deny,allow
</Limit>
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs  Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-  Document>
AuthType Default
Require user @OWNER @SYSTEM sonex
Order deny,allow
</Limit>
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-   Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer             Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @SYSTEM sonex
Order deny,allow
</Limit>
<Limit Cancel-Job CUPS-Authenticate-Job>
AuthType Default
Require user @OWNER @SYSTEM sonex
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>

也许我缺少某种前提?

我不能让用户成为 super 用户,因为客户正在使用这个帐户,他不应该是服务器上的 super 用户。

最佳答案

我通过谷歌搜索找到了这里:

取消:取消作业失败:禁止

我的解决方法是授予 lp 组运行 cups 命令的权限,然后将用户添加到 lp 组。

首先,将lp添加到/etc/cups-files.conf中的SystemGroup...

# Administrator user group, used to match @SYSTEM in cupsd.conf policy rules...
SystemGroup sys root lp

重启杯子...

systemctl 重启杯子

将用户添加到 lp 组。

usermod -a -G lp user1

user1 现在可以运行了

取消 PRINTER-12345

并使用 cups 站点上的 [Cancel Job] 按钮(将提示登录)。

From the cupsd.conf man page

Require user {user-name|@group-name} ...

Specifies that an authenticated user must match one of the named users or be a member of one of the named groups. The group name "@SYSTEM" corresponds to the list of groups defined by the SystemGroup directive in the cups-files.conf(5) file.

长话短说;

/etc/cupsd.conf 授予@SYSTEM 权限。

/etc/cups-files.conf SystemGroup 定义@SYSTEM。

关于linux - 杯子取消作业给出禁止的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49728220/

相关文章:

python - 在 Python 中打印新行对齐的字符串

configuration - CarrierWave 和 Fog、S3 存储桶和 store_dir 配置

hibernate - JPA 2.0 : Adding entity classes to PersistenceUnit *from different jar* automatically

linux - 文件内容中的参数中是否存在多个给出的单词?

android - 获取Android设备中的sd卡目录

c# - 使用打印设置从 WPF 打印 Word 文档(Aspose 生成)

html - 用 CSS 打印 DIV

user-interface - 在 Unity3d 中,如何将 float 窗口(例如光照贴图)添加到现有的一组选项卡(例如 : Inspector)?

c - lseek EOVERFLOW 错误处理

linux kernel->userspace 多播流数据报