spoolss printing with NT

Jean Francois Micouleau Jean-Francois.Micouleau at dalalu.fr
Wed May 3 21:03:40 GMT 2000

On Thu, 4 May 2000, Michael Glauche wrote:

> Ok .. I did play around with the new spoolss code (TNG 2.5.3) and nt 4.0 :
>  I got it to work .. sort of ;)
> When I add a new Printer to the server, it installs the printer-driver in the
> print$ share, but then
> I get a:
> add_a_printer_driver_3: Cannot create driver file
> [/opt/samba-tng/lib/NTdriver_W32X86_Kyocera F-800]. Error was Keine Berechtigung
> (no right to write there)
> Ok .. changed permission to .../lib to 777 and did try again, then it worked.
> (is there a smb.conf option to change this location ?)

	nt printer driver = /where/you/want
	nt forms file = /some/place/ntforms.def

> I can now see the queue of the Linux-Printer (at least it seems so).


> When I now try to print a test-page (within the printer-setup) it fails.


> When I click on the new Printer in the folders "Printers" on the samba-server,
> (there
> where I can find the queue), I can add the driver for the printer to the local
> machine (works fine),


> but I can't print.


> The port (in the NT window) is set to "lp" (the name of the normal lpr printer),
> and I get

normal as long as "lp" is also the sharename.

> malformed printer driver entry (no :)
> malformed printer driver entry (no :)


> write_socket_data: write failure. Error = Datenübergabe unterbrochen (broken
> pipe)
> write_socket: Error writing 32 bytes to socket 6: ERRNO = Datenübergabe
> unterbrochen (broken pipe)
> in the logfile.


> Is this suppose to work ? :) (i.e. does it make sense to look further into this
> yet ? ;) It looks very promising !

it works in HEAD.

I attached a quick step by step readme file explaining how to use the
new printing code of HEAD. I should add a copyright notice :-)


-------------- next part --------------
Printing from an NT4 machine to a Samba server and downloading NT printer's
driver to an NT box.

Jean François Micouleau (jfm at samba.org)
28 Mars 2000

Printing support for NT machines has been greatly enhanced in the HEAD
branch of Samba (aka Samba 3.0). To sum up, the new functionnalities are:

	- ability to list the printers and the print jobs using the native NT
	RPC calls
	- it's now possible to print directly to the samba server without first
	creating the printer on the workstation
	- the NT printer's driver can be stored on the samba server and be
	administratively downloaded on the workstation or automatically
	downloaded by the user at print time.

Setup of the Samba server:

You need to create a new hidden disk service (a share) called 'print$' in
the smb.conf file of samba. This share is being used to store the
printer's driver files (the dlls, the help files, the ppds, ...). It needs
to be readable by everyone so that every user can download the latest
version of the driver to the workstation and only writable to the
administrators/root accounts. So it's looking like this is in smb.conf:

        	path = /usr/local/samba/printers
        	guest ok = Yes
        	write list = ntadmin

inside the unix path pointed by the print$ share create a directory called

	mkdir /usr/local/samba/printers/W32X86

that's the directory where the files be will really stored for NT4 on i386
(intel) architecture. Even if the share is hidden, it's a good idea to
protect the directories from the unix side of things.

	chown ntadmin /usr/local/samba/printers/W32X86
	chmod 755 /usr/local/samba/printers
	chmod 755 /usr/local/samba/printers/W32X86

	where ntadmin is the unix account of the NT administrator.

Samba also needs to know where to store the printers definitions. Printers
definitions are text files describing the printers features like what
paper size is in upper bin or what's the driver dll file name. By default
the directory where those files will be stored is
'/usr/local/samba/lib/ntprinters' if samba is installed in the default
'/usr/local/samba' directory. As this directory is not (yet) created by
the make install, you have to do it by hand:

	mkdir /usr/local/samba/lib/ntprinters
	chown ntadmin /usr/local/samba/lib/ntprinters
	chmod 755 /usr/local/samba/lib/ntprinters

You can change this default location with the smb.conf directive 'nt
printer driver'. A special file named 'ntforms.def' by default will also
be stored in this directory, it's used to store the printers' paper sizes
of all the printers defined on the samba server. You can also change this
file's location in smb.conf, for example:

	 nt forms file = /usr/local/etc/nt_paper_size.def

Installing the printers on the Samba server:

Now that the Samba server is configured, you need to copy the drivers to
the samba server and build the printers definitions files. If you are an
NT printer admin wizard, you can copy the files by hand and construct the
definitions in your favorite editor. For example, the HP LaserJet 5P
driver definition looks like:

[root at doubleface ~]# cat /usr/local/samba/lib/ntprinters/NTdriver_W32X86_HP\ LaserJet\ 5P 
version:         2
name:            HP LaserJet 5P
environment:     Windows NT x86
driverpath:      RASDD.DLL
datafile:        PCL5EMS.DLL
configfile:      RASDDUI.DLL
helpfile:        RASDDUI.HLP
monitorname:     PJL Language Monitor
dependentfile:   PCL5EMS.DLL
dependentfile:   PJLMON.DLL
dependentfile:   RASDD.DLL
dependentfile:   RASDDUI.DLL
dependentfile:   RASDDUI.HLP
[root at doubleface ~]# 

and the printer definition file using this driver looks like:

[root at doubleface ntprinters]# cat NTprinter_name-s1 
attributes: 4120
priority: 0
default_priority: 0
starttime: 0
untiltime: 0
status: 1
cjobs: 0
averageppm: 0
printername: Laser
sharename: name-s1
portname: name-s1
drivername: HP LaserJet 5P
printprocessor: winprint
formname: A4
specversion: 1025
driverversion: 1024
size: 220
driverextra: 0
fields: 83731
orientation: 1
papersize: 9
paperlength: 0
paperwidth: 0
scale: 100
copies: 1
defaultsource: 15
printquality: 600
color: 1
duplex: 1
yresolution: 0
ttoption: 3
collate: 0
icmmethod: 0
icmintent: 0
mediatype: 0
dithertype: 0
specific: Country#4#4#21000000
specific: Model#1#30#4800500020004C0061007300650072004A00650074002000350050000000
specific: TrayFormTable#7#172#5000720065006D006900650072002000620061006300200064
specific: FreeMem#3#4#00080000
specific: RasddFlags#3#2#0000
specific: FontCart#7#6#300000000000

[root at doubleface ntprinters]#

Easy isn't it ? NO ? OK, there is an easier solution, you can make NT copy
the correct files to the samba server and generate the driver and printer
definition files. To do that, you have to find a free NT workstation (or
server) and log on with the ntadmin account who is allowed to write to the
print$ share and to the ntprinters/ directory as defined above.

Once logged on the NT box:
	- go to Network Neighborhood,
	- go to the Samba server where you want to install the NT drivers, 
	- click on the Printers folder, 
	- click on Add Printer,
	- you have no other choice to install on the Samba server, so
	click Next.
	- in the available ports list, you should get the printer shares
	list you have defined in the smb.conf file or that have been
	autoloaded from your printcap file. It's normal, under NT the
	basic entity for a printer is the port (LPT1:, LPT2, COM1:, ...)
	whereas with Samba it's the share entry. So select the share on
	which you want to install the NT printer and click Next,
	- select the printer model,
	- put the name you want,
	- sharing or not sharing has no effect. On Samba the printer is
	always shared,
	- you can try to print a test page to check that everything is 

At this point your printer driver is copied on the samba server and some
basic printer's parameters are also stored on the samba server. Now, you
need to check the printer's properties and the document defaults
properties as Samba has no way to figure them out. On an NT server this
step is not required as NT would run the printer's driver, asking the
default printer values and storing them in the registry. As Samba is
unable to run a NT driver, the administrator has to do it by hand.

To define the defaults values:
	- go to the Printers windows,
	- click on View -> Refresh or press the F5 key,
	- the printer you have setup would appear in the list,
	- do a right-click on the printer to get the context menu,
	- go on properties,
	- go on the device settings tab, check that the values are
	- click on OK,
	- get again the context menu to go on the document defaults,
	- check the values and click OK.

Now your printer is setup on the samba server.

More information about the samba-ntdom mailing list