Setting up Network Printer Ports
In Windows, printers must have a port assigned. This can be a local port, such as
LPT1, or for example for a remote port,
LPD Port Monitor. Per default, Samba auto-generates the
Samba Printer Port for all shared printers. However, in certain scenarios, you require to use unique port names.
How Samba Provides Custom Ports to the Windows Hosts
Samba enables you to use a script that outputs only the port names:
- The script can only output the port names by using
echocommands. For example:
#!/bin/bash echo "DemoPrinter1" echo "DemoPrinter2" echo "DemoPrinter3"
- You can write a script that generates the port names from configuration files, databases, or other sources.
|Every line the script outputs is used as a printer port. Make sure that the script does not output other content.|
Setting up Printer Ports
To enable Samba to display individual printer ports:
- Create a shell script. For example,
/usr/local/bin/samba-ports.shthat outputs each port in a new line. For details, see How Samba Provides Custom Ports to the Windows Hosts.
- Make the script executable:
# chmod 755 /usr/local/bin/samba-ports.sh
- Add the following parameter to the
[global]section in your
enumports command = /usr/local/bin/samba-ports.sh
- Reload Samba:
# smbcontrol all reload-config
The ports are now usable in the properties when preconfiguring a printer.
For details, see Preconfiguring a Printer.