免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2845 | 回复: 2
打印 上一主题 下一主题

[求助]SAMBA+cups配置打印机共享问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-02-24 09:58 |只看该作者 |倒序浏览
1、环境
A电脑装ubuntu8.10系统,上面安装了cups1.39,samba3.2。连接了一台HP1022的激光打印机,共享出来给windows客户端打印。


2、问题
1、现在所有windows客户端都可以连接到ubuntu电脑上的HP1022打印机,问题是添加打印机的时候,要手动添加一下驱动。不像windows共享的时候,自动安装驱动。
2、在windows下看到共享的打印机提示:拒绝连接,访问受限;但是奇怪的是可以正常使用该打印机。
3、通过http://IP地址:631,只能在ubuntu本机上连接,再其他电脑上访问不了。

3、相关配置文件:
A、smb.conf

  1. #
  2. # Sample configuration file for the Samba suite for Debian GNU/Linux.
  3. #
  4. #
  5. # This is the main Samba configuration file. You should read the
  6. # smb.conf(5) manual page in order to understand the options listed
  7. # here. Samba has a huge number of configurable options most of which
  8. # are not shown in this example
  9. #
  10. # Some options that are often worth tuning have been included as
  11. # commented-out examples in this file.
  12. #  - When such options are commented with ";", the proposed setting
  13. #    differs from the default Samba behaviour
  14. #  - When commented with "#", the proposed setting is the default
  15. #    behaviour of Samba but the option is considered important
  16. #    enough to be mentioned here
  17. #
  18. # NOTE: Whenever you modify this file you should run the command
  19. # "testparm" to check that you have not made any basic syntactic
  20. # errors.
  21. # A well-established practice is to name the original file
  22. # "smb.conf.master" and create the "real" config file with
  23. # testparm -s smb.conf.master >smb.conf
  24. # This minimizes the size of the really used smb.conf file
  25. # which, according to the Samba Team, impacts performance
  26. #

  27. #======================= Global Settings =======================

  28. [global]

  29. ## Browsing/Identification ###

  30. # Change this to the workgroup/NT-domain name your Samba server will part of
  31.    workgroup = Jimmy
  32.     unix charset = utf8
  33.      display charset = utf8
  34.       dos charset = cp936

  35. # server string is the equivalent of the NT Description field
  36. # server string = sd

  37. # Windows Internet Name Serving Support Section:
  38. # WINS Support - Tells the NMBD component of Samba to enable its WINS Server
  39. #   wins support = no

  40. # WINS Server - Tells the NMBD components of Samba to be a WINS Client
  41. # Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
  42. ;   wins server = w.x.y.z

  43. # This will prevent nmbd to search for NetBIOS names through DNS.
  44.    dns proxy = no

  45. # What naming service and in what order should we use to resolve host names
  46. # to IP addresses
  47. ;   name resolve order = lmhosts host wins bcast

  48. #### Networking ####

  49. # The specific set of interfaces / networks to bind to
  50. # This can be either the interface name or an IP address/netmask;
  51. # interface names are normally preferred
  52. ;   interfaces = 127.0.0.0/8 eth0

  53. # Only bind to the named interfaces and/or networks; you must use the
  54. # 'interfaces' option above to use this.
  55. # It is recommended that you enable this feature if your Samba machine is
  56. # not protected by a firewall or is a firewall itself.  However, this
  57. # option cannot handle dynamic or non-broadcast interfaces correctly.
  58. ;   bind interfaces only = yes



  59. #### Debugging/Accounting ####

  60. # This tells Samba to use a separate log file for each machine
  61. # that connects
  62.    log file = /var/log/samba/log.%m

  63. # Cap the size of the individual log files (in KiB).
  64.    max log size = 1000

  65. # If you want Samba to only log through syslog then set the following
  66. # parameter to 'yes'.
  67. #   syslog only = no

  68. # We want Samba to log a minimum amount of information to syslog. Everything
  69. # should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
  70. # through syslog you should set the following parameter to something higher.
  71.    syslog = 0

  72. # Do something sensible when Samba crashes: mail the admin a backtrace
  73.    panic action = /usr/share/samba/panic-action %d


  74. ####### Authentication #######

  75. # "security = user" is always a good idea. This will require a Unix account
  76. # in this server for every user accessing the server. See
  77. # /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
  78. # in the samba-doc package for details.
  79.    security = share

  80. # You may wish to use password encryption.  See the section on
  81. # 'encrypt passwords' in the smb.conf(5) manpage before enabling.
  82.    encrypt passwords = true

  83. # If you are using encrypted passwords, Samba will need to know what
  84. # password database type you are using.  
  85.    passdb backend = tdbsam

  86.    obey pam restrictions = yes

  87. # This boolean parameter controls whether Samba attempts to sync the Unix
  88. # password with the SMB password when the encrypted SMB password in the
  89. # passdb is changed.
  90.    unix password sync = yes

  91. # For Unix password sync to work on a Debian GNU/Linux system, the following
  92. # parameters must be set (thanks to Ian Kahan <<[email]kahan@informatik.tu-muenchen.de[/email]> for
  93. # sending the correct chat script for the passwd program in Debian Sarge).
  94.    passwd program = /usr/bin/passwd %u
  95.    passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .

  96. # This boolean controls whether PAM will be used for password changes
  97. # when requested by an SMB client instead of the program listed in
  98. # 'passwd program'. The default is 'no'.
  99.    pam password change = yes

  100. # This option controls how unsuccessful authentication attempts are mapped
  101. # to anonymous connections
  102. map to guest = bad user

  103. ########## Domains ###########

  104. # Is this machine able to authenticate users. Both PDC and BDC
  105. # must have this setting enabled. If you are the BDC you must
  106. # change the 'domain master' setting to no
  107. #
  108. ;   domain logons = yes
  109. #
  110. # The following setting only takes effect if 'domain logons' is set
  111. # It specifies the location of the user's profile directory
  112. # from the client point of view)
  113. # The following required a [profiles] share to be setup on the
  114. # samba server (see below)
  115. ;   logon path = \\%N\profiles\%U
  116. # Another common choice is storing the profile in the user's home directory
  117. # (this is Samba's default)
  118. #   logon path = \\%N\%U\profile

  119. # The following setting only takes effect if 'domain logons' is set
  120. # It specifies the location of a user's home directory (from the client
  121. # point of view)
  122. ;   logon drive = H:
  123. #   logon home = \\%N\%U

  124. # The following setting only takes effect if 'domain logons' is set
  125. # It specifies the script to run during logon. The script must be stored
  126. # in the [netlogon] share
  127. # NOTE: Must be store in 'DOS' file format convention
  128. ;   logon script = logon.cmd

  129. # This allows Unix users to be created on the domain controller via the SAMR
  130. # RPC pipe.  The example command creates a user account with a disabled Unix
  131. # password; please adapt to your needs
  132. ; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u

  133. ########## Printing ##########

  134. # If you want to automatically load your printer list rather
  135. # than setting them up individually then you'll need this
  136.    load printers = yes

  137. # lpr(ng) printing. You may wish to override the location of the
  138. # printcap file
  139. ;   printing = bsd
  140. ;   printcap name = /etc/printcap

  141. # CUPS printing.  See also the cupsaddsmb(8) manpage in the
  142. # cupsys-client package.
  143.    printing = cups
  144.    printcap name = cups

  145. ############ Misc ############

  146. # Using the following line enables you to customise your configuration
  147. # on a per machine basis. The %m gets replaced with the netbios name
  148. # of the machine that is connecting
  149. ;   include = /home/samba/etc/smb.conf.%m

  150. # Most people will find that this option gives better performance.
  151. # See smb.conf(5) and /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/speed.html
  152. # for details
  153. # You may want to add the following on a Linux system:
  154. #         SO_RCVBUF=8192 SO_SNDBUF=8192
  155. #   socket options = TCP_NODELAY

  156. # The following parameter is useful only if you have the linpopup package
  157. # installed. The samba maintainer and the linpopup maintainer are
  158. # working to ease installation and configuration of linpopup and samba.
  159. ;   message command = /bin/sh -c '/usr/bin/linpopup "%f" "%m" %s; rm %s' &

  160. # Domain Master specifies Samba to be the Domain Master Browser. If this
  161. # machine will be configured as a BDC (a secondary logon server), you
  162. # must set this to 'no'; otherwise, the default behavior is recommended.
  163. #   domain master = auto

  164. # Some defaults for winbind (make sure you're not using the ranges
  165. # for something else.)
  166. ;   idmap uid = 10000-20000
  167. ;   idmap gid = 10000-20000
  168. ;   template shell = /bin/bash

  169. # The following was the default behaviour in sarge,
  170. # but samba upstream reverted the default because it might induce
  171. # performance issues in large organizations.
  172. # See Debian bug #368251 for some of the consequences of *not*
  173. # having this setting and smb.conf(5) for details.
  174. ;   winbind enum groups = yes
  175. ;   winbind enum users = yes

  176. # Setup usershare options to enable non-root users to share folders
  177. # with the net usershare command.

  178. # Maximum number of usershare. 0 (default) means that usershare is disabled.
  179. ;   usershare max shares = 100

  180. # Allow users who've been granted usershare privileges to create
  181. # public shares, not just authenticated ones
  182.    usershare allow guests = yes

  183. #======================= Share Definitions =======================

  184. # Un-comment the following (and tweak the other settings below to suit)
  185. # to enable the default home directory shares.  This will share each
  186. # user's home directory as \\server\username
  187. ;[homes]
  188. ;   comment = Home Directories
  189. ;   browseable = no

  190. # By default, the home directories are exported read-only. Change the
  191. # next parameter to 'no' if you want to be able to write to them.
  192. ;   read only = yes

  193. # File creation mask is set to 0700 for security reasons. If you want to
  194. # create files with group=rw permissions, set next parameter to 0775.
  195. ;   create mask = 0700

  196. # Directory creation mask is set to 0700 for security reasons. If you want to
  197. # create dirs. with group=rw permissions, set next parameter to 0775.
  198. ;   directory mask = 0700

  199. # By default, \\server\username shares can be connected to by anyone
  200. # with access to the samba server.  Un-comment the following parameter
  201. # to make sure that only "username" can connect to \\server\username
  202. # This might need tweaking when using external authentication schemes
  203. ;   valid users = %S

  204. # Un-comment the following and create the netlogon directory for Domain Logons
  205. # (you need to configure Samba to act as a domain controller too.)
  206. ;[netlogon]
  207. ;   comment = Network Logon Service
  208. ;   path = /home/samba/netlogon
  209. ;   guest ok = yes
  210. ;   read only = yes
  211. ;   share modes = no

  212. # Un-comment the following and create the profiles directory to store
  213. # users profiles (see the "logon path" option above)
  214. # (you need to configure Samba to act as a domain controller too.)
  215. # The path below should be writable by all users so that their
  216. # profile directory may be created the first time they log on
  217. ;[profiles]
  218. ;   comment = Users profiles
  219. ;   path = /home/samba/profiles
  220. ;   guest ok = no
  221. ;   browseable = no
  222. ;   create mask = 0600
  223. ;   directory mask = 0700

  224. [printers]
  225.    comment = All Printers
  226.    browseable = yes
  227.    path = /var/spool/samba
  228.    printable = yes
  229.    guest ok = yes
  230.    read only = no
  231.    create mask = 0700

  232. # Windows clients look for this share name as a source of downloadable
  233. # printer drivers
  234. [print$]
  235.    comment = Printer Drivers
  236.    path = /var/lib/samba/printers
  237.    browseable = yes
  238.    read only = no
  239.    guest ok = yes
  240. # Uncomment to allow remote administration of Windows print drivers.
  241. # Replace 'ntadmin' with the name of the group your admin users are
  242. # members of.
  243. ;   write list = root, @ntadmin

  244. # A sample share for sharing your CD-ROM with others.
  245. ;[cdrom]
  246. ;   comment = Samba server's CD-ROM
  247. ;   read only = yes
  248. ;   locking = no
  249. ;   path = /cdrom
  250. ;   guest ok = yes

  251. # The next two parameters show how to auto-mount a CD-ROM when the
  252. #        cdrom share is accesed. For this to work /etc/fstab must contain
  253. #        an entry like this:
  254. #
  255. #       /dev/scd0   /cdrom  iso9660 defaults,noauto,ro,user   0 0
  256. #
  257. # The CD-ROM gets unmounted automatically after the connection to the
  258. #
  259. # If you don't want to use auto-mounting/unmounting make sure the CD
  260. #        is mounted on /cdrom
  261. #
  262. ;   preexec = /bin/mount /cdrom
  263. ;   postexec = /bin/umount /cdrom
  264. [D]
  265. path = /media/disk/d
  266. browseable = yes
  267. read only = no
  268. guest ok = yes
  269. public = yes
  270. [共享]
  271. path= /media/disk-1/共享
  272. browseable = yes
  273. read only = no
  274. guest ok = yes
  275. public = yes
复制代码


B、cupsd.conf

  1. LogLevel warning
  2. SystemGroup lpadmin
  3. # Allow remote access
  4. Port 631
  5. Listen /var/run/cups/cups.sock
  6. # Share local printers on the local network.
  7. Browsing On
  8. BrowseOrder allow,deny
  9. BrowseAddress @LOCAL
  10. DefaultAuthType Basic
  11. <Location />
  12.   Allow From 192.168.1.0/28
  13.   # Allow shared printing and remote administration...
  14.   Order allow,deny
  15.   Allow all
  16. </Location>
  17. <Location /admin>
  18.   Encryption Required
  19.   # Allow remote administration...
  20.   Order allow,deny
  21.   Allow all
  22. </Location>
  23. <Location /admin/conf>
  24.   AuthType Default
  25.   Require user @SYSTEM
  26.   # Allow remote access to the configuration files...
  27.   Order allow,deny
  28.   Allow all
  29. </Location>
  30. <Policy default>
  31.   <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job>
  32.     Require user @OWNER @SYSTEM
  33.     Order deny,allow
  34.   </Limit>
  35.   <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
  36.     AuthType Default
  37.     Require user @SYSTEM
  38.     Order deny,allow
  39.   </Limit>
  40.   <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Accept-Jobs CUPS-Reject-Jobs>
  41.     AuthType Default
  42.     Require user @SYSTEM
  43.     Order deny,allow
  44.   </Limit>
  45.   <Limit CUPS-Authenticate-Job>
  46.     Require user @OWNER @SYSTEM
  47.     Order deny,allow
  48.   </Limit>
  49.   <Limit All>
  50.     Order deny,allow
  51.   </Limit>
  52. </Policy>
复制代码

[ 本帖最后由 cheneylou 于 2009-2-24 10:00 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2009-03-01 21:29 |只看该作者

回复 #1 cheneylou 的帖子

lz测试的现象正常
添加打印机需要驱动信息设置一下的,在就是cups需要设置ip访问信息

论坛徽章:
0
3 [报告]
发表于 2009-03-02 17:17 |只看该作者
关注一下
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP