Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!chi-news.cic.net!newsfeed.internetmci.com!howland.reston.ans.net!ix.netcom.com!ncc-1701-d!d_burr From: d_burr@starfleet.gov (Donald Burr) Newsgroups: comp.unix.bsd.freebsd.misc Subject: Re: Network Printing Date: Sun, 12 Nov 1995 18:33:48 GMT Organization: Starfleet Command Lines: 132 Message-ID: <DHy0wC.3o0@starfleet.gov> References: <4829t9$15s_001@aone.net.au> <484a3v$lfg@mark.ucdavis.edu> Reply-To: d_burr@ix.netcom.com NNTP-Posting-Host: ix-sb1-05.ix.netcom.com X-NETCOM-Date: Sun Nov 12 2:28:32 PM PST 1995 In article <484a3v$lfg@mark.ucdavis.edu>, David E. O'Brien <obrien@cs.ucdavis.edu> wrote: >Nick Coppins (tran@s054.aone.net.au) wrote: >: Is it possible to print from a FreeBsd box to a printer attached to a >: Win95 box?? running tcp/ip protocol?? > >I've done it from FreeBSD to MS-NT. The real question is "does Win95 offer >an lpd style print server". If it does then you are set. FreeBSD and any >other BSD box will *easily* print to anything that accepts lpd connections. > >The /etc/printcap entry would be something like: > >win95printer:\ >:lp=/dev/null:sd=/var/spool/lpd:rm=win95box.billgates.com:lf=/var/log/lpd-errs: You can also do this, *very easily*, even if the remote (Win95) box is NOT running lpd spooling software. In fact, all you really need is the Microsoft Networks client, and Microsoft TCP/IP to be installed. And you'll need the SAMBA package on whatever FreeBSD machine(s) you want to be able to print. (This will also work if you're running Windows NT, or Windows for Workgroups 3.x. Just as long as you have the Microsoft TCP/IP service installed and configured correctly.) Here's how to set it up: Assume your FreeBSD box is called "freebsd-box" (really original name there), and your Win95 box is called "win95-box". Let's say the printer is shared under the name "printer", and you want the printer to be called "smblp" on the FreeBSD side. Put this entry into /etc/printcap: smblp:sd=/var/spool/smb:af=/var/spool/smb/acct:if=/usr/local/samba/bin/smbprint:mx=0:lp=/dev/null Create the /var/spool/smb directory, with these permissions and owners: drwxrwxr-x 2 bin daemon 512 Nov 6 02:12 /var/spool/smb/ Now, create the file "/var/spool/smb/.config" with these contents: server=WIN95-BOX service=PRINTER password="" Now, you will need to install the following script into "/usr/local/samba/bin/smbprint": #!/bin/sh # This script is an input filter for printcap printing on a unix machine. It # uses the smbclient program to print the file to the specified smb-based # server and service. # For example you could have a printcap entry like this # # smb:lp=/dev/null:sd=/usr/spool/smb:sh:if=/usr/local/samba/smbprint # # which would create a unix printer called "smb" that will print via this # script. You will need to create the spool directory /usr/spool/smb with # appropriate permissions and ownerships for your system. # Set these to the server and service you wish to print to # In this example I have a WfWg PC called "lapland" that has a printer # exported called "printer" with no password. # # Script further altered by hamiltom@ecnz.co.nz (Michael Hamilton) # so that the server, service, and password can be read from # a /usr/var/spool/lpd/PRINTNAME/.config file. # # In order for this to work the /etc/printcap entry must include an # accounting file (af=...): # # cdcolour:\ # :cm=CD IBM Colorjet on 6th:\ # :sd=/var/spool/lpd/cdcolour:\ # :af=/var/spool/lpd/cdcolour/acct:\ # :if=/usr/local/etc/smbprint:\ # :mx=0:\ # :lp=/dev/null: # # The /usr/var/spool/lpd/PRINTNAME/.config file should contain: # server=PC_SERVER # service=PR_SHARENAME # password="password" # # E.g. # server=PAULS_PC # service=CJET_371 # password="" # # Debugging log file, change to /dev/null if you like. # # logfile=/tmp/smb-print.log logfile=/dev/null # # The last parameter to the filter is the accounting file name. # Extract the directory name from the file name. # Concat this with /.config to get the config file. # eval acct_file=\$$# spool_dir=`dirname $acct_file` config_file=$spool_dir/.config # Should read the following variables set in the config file: # server # service # password eval `cat $config_file` # # Some debugging help, change the >> to > if you want to same space. # echo "server $server, service $service" >> $logfile ( # NOTE You may wish to add the line `echo translate' if you want automatic # CR/LF translation when printing. echo translate echo "print -" cat echo -n "" ) | /usr/local/samba/bin/smbclient "\\\\$server\\$service" $password -U $server -N -P >> $logfile now, just "lpr -Psmblp /etc/passwd" and watch the page shoot out of your printer! There are ways you can also "emulate" a PostScript printer this way, if youa are interested, please e-mail me and I'll send you details. -- Donald Burr [d_burr@ix.netcom.com], PO Box 91212, Santa Barbara CA 93190-1212 TEL (805)564-1871 // FAX 564-2315 // WWW http://www.physics.ucsb.edu/~dburr PGP Public Key available by request (send e-mail) or Public Key Servers. ** Uphold your right to privacy - Use PGP. **