Samba Print Server?

Pierre Burri pierre at globeall.de
Fri Oct 26 09:04:02 GMT 2001


I guess that might help you: 
I tested it with SuSE Linux 7.2, CUPS and Win2K, Samba as a PDC 
+ Printer Server. If you use lpr insthead of cups, you will have to adapt the 
script addprinter.

(Of course the directory and group names are just examples)
On Linux:
1.you need samba Version >= 2.2.1a 
2.create a new group ntadmin as a printer administrator group
3.create an account for the printer administrator with: passwd -g ntadmin
4.add the same account with smbpasswd -ae
5.if not added yet: smbpasswd -ae root otherwise win2000 can not connect to 
the Domain the first time. It is probably adviseable to not give the same 
password as the original password under linux.
6.add an accout for every host (with a $ at the end): 
useradd  -s /bin/false -d /dev/null hostname$
7.add the same account in smbpasswd:
smbpasswd -a -m  hostname$
8.create a structure for the profiles and the drivers:
mkdir /home/samba/
cd /home/samba
mkdir netlogon  profiles  printers
chown :ntadmin printers
chmod 775 printers
chmod 777 profiles
mkdir  printers/W32X86   printers/WIN40
the drivers will be copied from APW in a subdirectory of W32X86, for e.g.  2  
9.modify /etc/smb.conf with all entries for the PDC, print$ etc.
10.create a script /usr/bin/addprinter that will create a printer 
11.add with visudo the possibility for printer administrators to reload samba:
Cmnd_Alias RCSMB=/etc/init.d/smb
madmin  THIS_HOST=NOPASSWD:RCSMB
12.add SystemGroup ntadmin in /etc/cups/cupsd.conf
and reload cups.


On Windows2000
1.join the domain with user root, (Settings - System - Network 
Identification) you probably have to reboot afterwards...
2.log in as a printer administrator in the domain
3.click on the Network Neighborhood und search for your samba server
4.click on the samba server folder and then on the printer folder
5.click on the Add Printer Wizzard (APW) and install a printer. You need of 
course some drivers for this. Don't print a test page, it doesn'work. 
6.you should now be able to see your new printer.
if you get an "access denied", this mean your script addprinter doesn't work.
7.go to the regular "Printers" folder in the "Settings" and add a new network 
printer (the one you just uploaded). This time, the drivers will be copied 
from samba to your win2k directory: X:WINNT\System32\spool\drivers\W32X86\...
8.print a test page, that's it!

File /usr/bin/addprinter

#!/bin/sh
# Name:    /usr/bin/addprinter
# Authors: Pierre Burri & Michel Bisson 
# Date:    7-Oct-2001
# This script adds a CUPS printer (Postscript) from Windows2000 APW 
# with Samba Version 2.2.1a. (APW = Add Printer Wizard)
#--------------------------------------------------------------------
# Parameters given by the APW:
# $1 = printer name
# $2 = share name
# $3 = port name
# $4 = driver name
# $5 = location
# $6 = windows 9x driver location
#--------------------------------------------------------------------
smb_pr_dir="/home/samba/printers"
addpr_log="$smb_pr_dir/addprinter.log"
print_port="parallel:/dev/lp0"
#
echo "----------------------" >> $addpr_log
echo "date : `date`"          >> $addpr_log 
echo "all parameters : 1=<$1> 2=<$2> 3=<$3> 4=<$4> 5=<$5> 6=<$6>" >> 
$addpr_log 
# extract the PPD file name 
driver=$(grep -lr "$4" $smb_pr_dir/W32X86 |head -1)
echo "driver name : <$driver>"  >> $addpr_log 
# add the printer to cups
/usr/sbin/lpadmin -p $2 -P $driver -L "$5" -v $print_port -E >> $addpr_log  
2>>1&
# reload samba (with the SuSE Linux script)
sudo /etc/init.d/smb reload
sleep 3


File smb.conf:

[global]
   workgroup = STARS  
   server string = Linux Samba PDC Server %v
   guest account = nobody
   keep alive = 30
   os level = 64
   kernel oplocks = false
   security = user
   debug level = 2
   printer admin = @ntadmin
;
; Uncomment the following, if you want to use an existing
; NT-Server to authenticate users, but don't forget that
; you also have to create them locally!!!
;  security = server
;  password server = 192.168.1.10

   encrypt passwords = yes


   printing = cups
   printcap name = /etc/printcap
   load printers = yes
;
; script to execute when a printer is added through the APW from Win2K
   addprinter command = /usr/bin/addprinter

   socket options = TCP_NODELAY
   map to guest = Bad User

; Uncomment this, if you want to integrate your server
; into an existing net e.g. with NT-WS to prevent nettraffic
;  local master = no   
   local master = yes

; Do you wan't samba to act as a logon-server for
; your windows 95/98 clients, so uncomment the
; following:
   domain logons = yes
   logon path = \\%L\Profiles\%u
   logon drive = H:
   logon home = \\%L\%u
;   logon script = %U.cmd

   domain master = yes
   preferred master = yes

[netlogon]
   path = /home/samba/netlogon
   writeable = no
   writelist = ntadmin




; share for storing user profiles
[profiles]
   path = /home/samba/profiles
   writeable = yes
   browseable = no
   create mask = 0600
   directory mask = 0700

; share for storing printer drivers
[print$]
   path = /home/samba/printers
   public = yes
   browseable = yes
   read only = yes
   write list = Administrator,madmin,root 
   directory mask = 0775

[homes]
   comment = home directory
   browseable = no
   read only = no
   create mode = 0750

[printers]
   comment = all printers
   browseable = no
   printable = yes
   public = no
   read only = yes
   create mode = 0700
   directory = /tmp

- 
Feel free to visit my Site! http://www.GlobeAll.de

Pierre Burri
Tel.  +49 30 757 02 517
Fax:  +49 30 757 02 518

-





More information about the samba-ntdom mailing list