其他分享
首页 > 其他分享> > 树莓使用CUPS服务搭建打印机服务器

树莓使用CUPS服务搭建打印机服务器

作者:互联网

树莓使用CUPS服务搭建打印机服务器

安装各项软件和进行配置
在树莓派的终端中输入一下代码

sudo su //获取用户权限

apt get update //获取更新状态

apt-get install hplip //安装驱动

apt-get install cups //等待连接CUPS服务器

sudo usermod -a -G lpadmin pi 将用户添加到Ipadmin,pi代表用户名

sudo service cups stop //关闭cups的相关服务

改写配置文件
cd /etc/cups
nano cupsd.conf

# Only listen for connections from the local machine.
#Listen localhost:631
 
#CHANGED TO LISTEN TO LOCAL LAN
Port 631
 
# Restrict access to the server…
<Location />
Order allow,deny
Allow @Local
</Location>
 
# Restrict access to the admin pages…
<Location /admin>
Order allow,deny
Allow @Local
</Location>
 
# Restrict access to configuration files…
<Location /admin/conf>
AuthType Default
Require user @SYSTEM
Order allow,deny
Allow @Local
</Location>

改写完后记得ctrl+O进行写入保存,回车后ctrl+X退出
修改完后重新启动cups服务
sudo service cups restart

在树莓派浏览器中输入
http://树莓的IP:631

访问时可能会出现网页不安全警告,一般无需理会,继续访问

提示你输入用户和密码时则直接使用树莓派管理员用户登录即可。

登录后选择Administartion

子选项中有Add Printer选择,点进去后就能看见USB连接到树莓派的打印机,注意勾选打印机的序号,下面的网络协议可以不勾选。

进入配置名字和用户组的界面时需要勾选最下方的Share This Printer。点击continue

在Model中勾选打印机需要的对应驱动,点击Add Printer

标签:树莓,CUPS,get,sudo,打印机,Restrict,cups
来源: https://blog.csdn.net/zx201902020050/article/details/116290640