在Ubuntu中共享Spool目录(通常用于打印机队列等临时文件)需注意安全风险,以下是两种常见方法及注意事项:
sudo apt update && sudo apt install cups
sudo systemctl start cups && sudo systemctl enable cups
http://localhost:631
,登录后进入 Administration → Add Printer,添加需共享的打印机,勾选 Share Printer。/etc/cups/cupsd.conf
,将 Listen localhost:631
改为 Listen 0.0.0.0:631
,并设置 Allow all
以允许远程访问。http://<Ubuntu服务器IP>:631
添加共享打印机,需输入CUPS用户名和密码。sudo apt update && sudo apt install samba
/etc/samba/smb.conf
,添加以下内容(需将路径替换为实际Spool目录):[spool_share]
path = /var/spool/samba
browseable = yes
guest ok = yes
writable = no
printable = yes
重启Samba服务:sudo systemctl restart smbd
。\\<Ubuntu服务器IP>\spool_share
访问(需启用Samba客户端)。/var/spool
下敏感目录(如 cups
)开放完全访问权限,优先通过CUPS或NFS共享特定子目录。参考来源: