2、配置cupsys shell>sudo vim /etc/cups/cupsd.conf Listen 631 # Restrict access to the server... <Location /> Order allow,deny Allow all </Location> # Restrict access to the admin pages... <Location /admin> Order allow,deny Allow from 192.168.0.205 #你所允許訪問你的cups服務的電腦,默認的話,僅有本機可以訪問 </Location>
這裡只列舉關鍵代碼,其它默認。重啟cupsys
shell>sudo /etc/init.d/cupsys restart
訪問CUPS配置頁面配置印表機,這裡可能會要求你使用機器里設置的域名來訪問,可能會出現打不開的問題,到時候你自己改一下就行了,或者修改你的/etc/hosts文件,添加相應的條目即可。 啟動cups服務后:在瀏覽器里直接輸入(註:這個是是本機操作) http://127.0.0.1:631 里選Administration,選上 Show printers shared by other systems Share published printers connected to this system 新版本的還有一個也選上 Allow printing from the Internet 然後在客戶機上,不管是win還是linux,添加印表機,選ipp印表機,格式如下: ipp://X.X.X.X:631/printers/印表機名 (linux下測試成功) http://X.X.X.X:631/印表機名 (win下測試成功)
workgroup=yourgroupname #這個是想共享的目錄名 server string=abc security=share load printers = yes
printing = cups printcap name = cups comment = All Printers path = /var/spool/samba browseable = no guest ok = yes read only = yes writable = no printable = yes create mask = 0700
# Windows clients look for this share name as a source of downloadable # printer drivers
comment = Printer Drivers path = /var/lib/samba/printers browseable = yes read only = yes guest ok = no # Uncomment to allow remote administration of Windows print drivers. # Replace 'ntadmin' with the name of the group your admin users are # members of. write list = root
四、為windows客戶機提供驅動 (理論上來說,完成這一步就可以在連接網路印表機里免驅動了,然而這一步我沒有成功,但寫出來共享一下,說不定有成功的案例呢) 參考網址:http://www.enterprisenetworkingp ... article.php/3621876 這時要提示的是,要在samba的配置文件中將root用戶開啟,security不要更改,默認為user。如果改成了share,那麼在cupsaddsmb時,會出現如下提示 Server not using user level security and no password supplied. 文件不能多也不能少,文件名不能錯,不能大寫。文件列表
如果成功,說明已經可以為windows 用戶提供驅動了。當然你也可以查看/var/lib/samba/printers/W32X86目錄查看文件是否已經複製成功。 我把所有一切都做完了,當客戶機連接SAMBA共享印表機時還是提示驅動不正確,而且使用windows下的驅動程序安裝里也提示不正確。經過研究,發現大部分情況下安裝Winstchs.exe就行了,如果不行可以通過http://ipaddress/printer/printer_name來連接印表機,這個地址可以通過前面CUPS的設置處獲得。 總結,連接CUPS+SAMBA的印表機有兩種情況,一種是通過SAMBA共享,需要Winstchs.exe提供的驅動;另一種是通過CUPS提供的網路印表機地址來連接,這種要印表機在windows 下的驅動。 Winstchs.exe是Adobe公司提供的Postscript drivers,下載地址如下:http://www.adobe.com/support/dow ... 4&platform=W... 註:關於這部分的內容可以參見 Export Printers to Samba https://ipaddress:631/admin/?op=export-samba This page allows you to export printers to Samba so that Windows clients can access them through the Network Neighborhood or Network Places icons on their desktop. You must previously install the Windows PostScript printer drivers as described in the cupsaddsmb(8) man page.
2. Linux客戶端的配置稍微麻煩那麼一點點,那就是同樣需要cups和samba(samba或許不需要,沒有測試過),在cups中添加印表機的時候,在選擇列印設備的時候選擇「Windows printer via samba」,然後下一個界面要求你輸入網路中的位置,由於我們是通過samba服務共享的,當然是以smb://開頭啦,但是後面怎麼寫曾經難了我很長時間,現在我知道一招啦:
利用smbclient: $ smbclient -L (server string) server string是先前設置的samba伺服器名。