Printing from AIX to WinNT/95/3.1
From: Charles J. Fisher
1. On your Windows system, share the printer. Assuming that you are
running NT, make a user "root" with some password.
2. Get the Samba distribution from http://www.samba.org
If you have a C compiler, get the source and compile it.
If you don't have a C compiler, get a binary distribution for AIX.
3. Install Samba on AIX under /usr/local/samba. Specifically, make sure
that /usr/local/samba/bin/smbclient is installed with execute rights
4. You must also install a Samba configuration file under
If you intend to use your AIX as a file server for windows clients,
you should modify smb.conf to accomplish this (see the Samba
If you will be printing only, just use the sample smb.conf.
5. Make the directory /usr/local/samba/lib/printers
6. In that directory, install the following shell script as
# This is a modification of the samba provided smbprint script
# changed to work under AIX as the backend for a queue. It does
# not read a config file.
# Variables below define the server and service. They are
# the content of the .config file when printing from
# Debugging log file, change to /dev/null if you like.
# Some debugging help, change the >> to > if you want to save space.
#echo "server $server, service $service" >> $logfile
#cat $1 | /usr/local/samba/bin/smbclient "\\\\$server\\$service"
# -N -P -c 'print -' >> $logfile
# NOTE You may wish to add the line `echo translate' if you want automatic
# CR/LF translation when printing.
echo "print -"
) | /usr/local/samba/bin/smbclient "\\\\$server\\$service" $password \
-U "$user" -N -P > /dev/null
7. The above file assumes that you are using \\winserver\winprinter
as the printer share, and that the user is "root" and the password
is "root". If this is not the case, modify the shell variable
8. Mark the file with execute permissions with "chmod 755 winprint"
9. Test the script with the command: "./winprint /etc/passwd"
If everything is ok, your password file should be spooled to your
If it doesn't work, remove the "> /dev/null" from the last line of
the script and rerun it. Examine the output of smbclient for clues.
Clue #1: The Windows printer server is on the other side of a router.
AIX is sending broadcast packets to find the Windows machine,
which the router will not forward. You must find the Windows
server's IP address and specify it with the "-I" parameter
to smbclient, i.e. "-I 184.108.40.206". DHCP makes this situation
even more complex.
Clue #2: You username or password is wrong. smbclient will tell you
about this if you free its output from > /dev/null.
Clue #3: You might be violating shell quoting rules if you use
special characters in the server or share name, password,
etc. Don't use $, ", ', etc., or escape them properly.
A password of ";rm -rf /" could be catastrophic.
10. Once the script can print files, it must be defined as a printer in
the /etc/qconfig file. Add the following lines to the end of your
device = dwinprint
up = TRUE
discipline = sjn
backend = /usr/local/samba/lib/printers/winprint
11. Test the printer with the following command:
"lp -d winprint /etc/passwd"
(Your password file should be printed again.)
12. You might examine the queue with the command "lpq -P winprint"
or "lpstat -t"