星期一, 一月 15, 2007

命令行设置Linux CUPS连接windows打印机

http://www.linux.com/howtos/Debian-and-Windows-Shared-Printing/printing_to_windows.shtml

基本上是参考这里的步骤做的,虽然我是在RHEL4上面实现的

1.查找windows打印机
#/usr/bin/smbclient -L puma -U ttan
用ttan这个用户连上puma查看共享的目录或打印机

结果显示如下:

Sharename Type Comment
--------- ---- -------
print$ Disk ┤
C$ Disk ─
shared Disk
TD_Dir Disk TestDirector
download Disk
F$ Disk ─
IPC$ IPC
EPSONAL- Printer EPSON AL-C1100 Advanced
ADMIN$ Disk
D$ Disk ─
hpLaserJ Printer hp LaserJet 1320 PCL 6

这里我们要用到的就是hpLaserJ这个打印机

2.配置CUPS
#ls -l /usr/lib/cups/backend/smb
确认CUPS是否安装了smb。
如果没有
#ln -s `which smbspool` /usr/lib/cups/backend/smb

添加打印机
#lpadmin -p pumahp -v smb://ttan:password@puma/hpLaserJ -P
/usr/share/cups/model/laserjet.ppd.gz

-p是打印机名称,这个可以自己设置
-v就是打印机设备的URI.
-P是使用的ppd,PostScript Printer Description

#/usr/bin/enable pumahp
启用打印机
#/usr/sbin/accept pumahp
打印系统接受发往pumahp的打印任务
#/usr/sbin/lpadmin -d pumahp
设置pumahp为默认打印机

3.开始打印咯
#lpr /etc/fstab
#lpq
pumahp is ready and printing
Rank Owner Job File(s) Total Size
active root 1 fstab 1024 bytes

备注:
或者第二步可以直接修改配置文件
/etc/cups/printers.conf

Info pumahp
DeviceURI smb://ttan:password@puma/hpLaserJ
State Idle
Accepting Yes
JobSheets none none
QuotaPeriod 0
PageLimit 0
KLimit 0

没有评论: