If you did not migrate your account yet, visit https://idp-portal-info.suse.com/
SDB:Printing via SMB (Samba) Share or Windows Share
You want to print to a printer that is connected to an SMB host or a printer that can be addressed over the network via an SMB host.
An SMB host is a host that can be addressed by means of the SMB protocol. Normally, this is a Windows host. However, it can also be a Linux host running the "Samba" service. To address the printer by means of the SMB protocol, the SMB host must have a "share" for this printer.
The printer share is identified by unique "names" in the network:
- Host name of the SMB host (always needed)
- Name of the shares (always needed)
- Name of the "workgroup" (not always needed)
Additionally, a user name and a password may be required to access the printer share.
These names, which are required by the SMB protocol, are managed by the NetBIOS name service, which must be clearly distinguished from the usual DNS name service in TCP/IP networks. Although the SMB protocol is based on the TCP/IP protocol, the SMB protocol uses NetBIOS instead of DNS as name service. The NetBIOS host name can be different from the DNS host name, but usually the NetBIOS host name and the DNS host name are identical. However, the DNS domain does not make any sense in the NetBIOS name space. Accordingly, the fully qualified DNS host name consisting of the DNS host name and DNS domain does not make any sense in the NetBIOS name space.
When a printer is addressed by a Linux host by means of the SMB protocol, this is merely for data transfer. The SMB host does not convert the print data from the applications (e.g., PostScript) to printer-specific data. Therefore, the filtering must take place on the Linux host, which requires a complete print system on the Linux host. A queue with filtering must be set up on the Linux host. After the data is filtered, the queue sends the printer-specific data to the SMB share. The SMB share receives the printer-specific data and forwards it to the printer associated with the share.
- The package "samba-client" is needed for sending data (printer data) to an SMB share.
- Additionally, a complete print system (CUPS plus printer drivers) is needed.
Determining the NetBIOS Names
The command "nmbstatus" lists the workgroups available in the network and the respective NetBIOS host names, for example:
user@host> nmbstatus Found 123 hosts. Collecting additional information. Please wait. ... WORKGROUP TUX-NET MEMBERS GEEKO TUX ...
The command "smbclient -L NetBIOS-hostname -N" lists available shares on the SMB host with the specified NetBIOS host names, for example:
user@host> smbclient -L GEEKO -N ... Sharename Type Comment --------- ---- ------- LPT1 Printer ...
If necessary, add "-U username%password" to list shares that require a user name and a password for access:
smbclient -L GEEKO -U USER%PASSWORD -N
Testing the Printer
The following command sends one carriage-return character "\r" to the printer via the SMB share. Nothing is printed, but the printer may eject an empty page.
echo -en "\r" | smbclient "//NetBIOS-hostname/share" -c "print -" -N
Insert the respective NetBIOS host name and the share. If necessary, a workgroup and a user name and password can be added to the smbclient command:
smbclient "//NetBIOS-hostname/share" "password" -c "print -" -N -U "username" -W "workgroup"
If the printer is able to print ASCII text directly (without any additional printer driver software), the echo command can be replaced with the command
echo -en "\rHello\r\f"
to print the word "Hello", see SDB:Installing a Printer.
The entire command sequence could appear as follows:
echo -en "\rHello\r\f" | smbclient "//NetBIOS-hostname/share" "password" -c "print -" -N -U "username" -W "workgroup"
Insert the correct NetBIOS host name and share. If necessary, insert the password, user name, and workgroup.
The Correct DeviceURI for CUPS
In CUPS, the DeviceURI in /etc/cups/printers.conf determines how the data should be sent to the printer (or to the SMB share). The DeviceURI must be as specified in "man smbspool":
smb://server/printer smb://workgroup/server/printer smb://username:password@server/printer smb://username:password@workgroup/server/printer
"server" refers to the NetBIOS host name and "printer" refers to the share. The values for "server" and "printer" (and for "username", "password", and "workgroup", if necessary) must correspond to those used in the above command for the NetBIOS host name and share (and for the password, user name, and workgroup, if necessary).
See Swerdna's contemporary version: Printer Sharing: openSUSE 10 and 11 Samba Print Server for Linux & Windows Clients