This is part of the rhce course. In addition to file sharing, Samba can also provide printer sharing like sharing in windows. Before proceeding, we should first look at the CUPS service. cups is a service application for managing printing in Linux. It supports IPP, LPD, SMB, and JetDirect interfaces. The cups service itself can also achieve print sharing, but adding a cups sharing printer in windows is not difficult. You can use Samba to connect to the local cups service first, and then samba will provide the print sharing service.
I. cups service configuration
1. Install cups Software packages
# Yum-y install cups
2. Edit cups service configuration
# Vim/etc/cups/cupsd. conf # Change Listen localhost: 631 to Listen 0.0.0.0: 631 // Listen to all IP addresses # By default, access from a remote host browser is not allowed. Here, allow and deny are reversed, or add allow from * <Location/> # Order allow, deny // The default configuration part of Order deny, allow // modified content </Location> # set the admin item to only allow access from a host or a certain host <Location/admin> Order deny, allow deny from all allow from 192.168.1. * </Location>
3. Firewall configuration
# Firewall-cmd -- permanent -- add-port = 631/tcp # firewall-cmd -- reload
4. Add a printer in browser configuration
You can use the lpadmin command to add a printer, or enter http: // IP: 631 in a browser to access the printer, as shown in the following figure:
After adding a printer through add printer (the root user name and password of the host will be input when the printer is added), you can view the list of currently listed machines through the top prints item:
2. Samba service configuration
Start the Samba service as described in the previous two articles, and enable the following two lines in global configuration (by default, these two lines are enabled ):
Security = usermap to guest = Bad Userload printers = yescups options = raw
Enable the following in the shared items (which also exists in the default configuration ):
[Printers] comment = All Printers path =/var/spool/samba browseable = no guest OK = no writable = no printable = yes
After the configuration is complete, systemctl retart nmb smb restarts the two services for the new configuration to take effect. On a windows host, enter \ 192.168.1.200 in the running state to view the current shared items. You can find the list of shared printed hosts:
Double-click the printer to confirm that the corresponding driver is installed. Then, you can select the printer on the local machine and print it.
Summary:
Currently, due to the low cost of printers, most mainstream printers are network printers. Generally, samba + cups is not used for configuration, this solution is mainly used in the company with multiple printers, USB, serial port, network, and multiple different parts may have IP segments that cannot be crossed, at this time, you can use a samba + cups server to implement centralized management by configuring multiple network adapters and interfaces, so that different parts can be connected and used. In addition, permission control is also applied to the printer.