LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 537|回复: 2

解疑:设置FedoraCore4 Samba,加入Windows的Workgroup

[复制链接]
发表于 2005-10-25 01:42:17 | 显示全部楼层 |阅读模式
我家有多台电脑,想组成一个网络,现有一台linux,我想利用SAMBA,让网络上的其他windows客户端能连接到linux的共享。
草图如下:


目标:所有在192.168.1.*网段的计算机看到我的LINUX共享
备注:因为是家庭网络,想利用SAMBA成为一个无防备的共享服务器,大家在进入的TMP文件夹的时候不需要输入用户名或密码,直接进入;进入Share文件夹的时候指定用户名和密码。并且,linux也可以访问192.168.1.*网段的windows计算机。

我在设置SAMBA之后,尝试从192.168.1.2进入SAMBA共享,出现如下警告:


请各位帮忙给我看看我的设置哪里不妥当,让我修改修改。谢谢,如有问题请回帖说明,我会尽快回答。

执行testparm -s /etc/samba/smb.conf

  1. Load smb config files from /etc/samba/smb.conf
  2. Processing section "[homes]"
  3. Processing section "[printers]"
  4. Processing section "[share]"
  5. Processing section "[tmp]"
  6. Loaded services file OK.
  7. # Global parameters
  8. [global]
  9.         server string = Zeke's FedoraCore
  10.         guest account = zeke
  11.         username map = /etc/samba/smbusers
  12.         log file = /var/log/samba/%m.log
  13.         max log size = 0
  14.         socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
  15.         printcap name = /etc/printcap
  16.         dns proxy = No
  17.         idmap uid = 16777216-33554431
  18.         idmap gid = 16777216-33554431
  19.         guest ok = Yes
  20.         cups options = raw

  21. [homes]
  22.         comment = Home Directories
  23.         read only = No
  24.         browseable = No

  25. [printers]
  26.         comment = All Printers
  27.         path = /var/spool/samba
  28.         printable = Yes
  29.         browseable = No

  30. [share]
  31.         comment = Zeke'sLinuxShare
  32.         path = /home/zeke/Shares
  33.         read only = No
  34.         guest only = Yes

  35. [tmp]
  36.         comment = Temporary file space
  37.         path = /tmp
  38.         read only = No
  39.         guest only = Yes
  40. [zeke@ZekeFedora ~]$ smbclient //localhost/tmp
  41. Error connecting to 127.0.0.1 (Connection refused)
  42. Connection to localhost failed
复制代码

我的lmhosts设置如下:

  1. 127.0.0.1          localhost
  2. 192.168.1.2      zike
复制代码

smb.conf设置如下:

  1. #======================= Global Settings =====================================
  2. [global]

  3. # workgroup = NT-Domain-Name or Workgroup-Name
  4.     workgroup = workgroup

  5. # server string is the equivalent of the NT Description field
  6.     server string = Zeke's FedoraCore

  7. # This option is important for security. It allows you to restrict
  8. # connections to machines which are on your local network. The
  9. # following example restricts access to two C class networks and
  10. # the "loopback" interface. For more examples of the syntax see
  11. # the smb.conf man page
  12. ;   hosts allow = 192.168.1. 192.168.2. 127.

  13. # if you want to automatically load your printer list rather
  14. # than setting them up individually then you'll need this
  15.     printcap name = /etc/printcap
  16.     load printers = yes

  17. # It should not be necessary to spell out the print system type unless
  18. # yours is non-standard. Currently supported print systems include:
  19. # bsd, sysv, plp, lprng, aix, hpux, qnx
  20. ;   printing = cups

  21. # This option tells cups that the data has already been rasterized
  22.     cups options = raw

  23. # Uncomment this if you want a guest account, you must add this to /etc/passwd
  24. # otherwise the user "nobody" is used
  25. ;  guest account = pcguest

  26. # this tells Samba to use a separate log file for each machine
  27. # that connects
  28.     log file = /var/log/samba/%m.log
  29. # all log information in one file
  30. #   log file = /var/log/samba/log.smbd

  31. # Put a capping on the size of the log files (in Kb).
  32.     max log size = 0

  33. # Security mode. Most people will want user level security. See
  34. # security_level.txt for details.
  35. ;    security = share
  36. # Use password server option only with security = server
  37. ;   password server = *

  38. # Password Level allows matching of _n_ characters of the password for
  39. # all combinations of upper and lower case.
  40. ;  password level = 8
  41. ;  username level = 8

  42. # You may wish to use password encryption. Please read
  43. # ENCRYPTION.txt, Win95.txt and WinNT.txt in the Samba documentation.
  44. # Do not enable this option unless you have read those documents
  45. ;  encrypt passwords = yes
  46. ;  smb passwd file = /etc/samba/smbpasswd

  47. # The following are needed to allow password changing from Windows to
  48. # update the Linux system password also.
  49. # NOTE: Use these with 'encrypt passwords' and 'smb passwd file' above.
  50. # NOTE2: You do NOT need these to allow workstations to change only
  51. #        the encrypted SMB passwords. They allow the Unix password
  52. #        to be kept in sync with the SMB password.
  53. ;  unix password sync = Yes
  54. ;  passwd program = /usr/bin/passwd %u
  55. ;  passwd chat = *New*UNIX*password* %n\n *ReType*new*UNIX*password* %n\n *passwd:*all*authentication*tokens*updated*successfully*

  56. # Unix users can map to different SMB User names
  57. ;  username map = /etc/samba/smbusers

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

  62. # Most people will find that this option gives better performance.
  63. # See speed.txt and the manual pages for details
  64.     socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

  65. # Configure Samba to use multiple interfaces
  66. # If you have multiple network interfaces then you must list them
  67. # here. See the man page for details.
  68. ;   interfaces = 192.168.1.3/24

  69. # Configure remote browse list synchronisation here
  70. #  request announcement to, or browse list sync from:
  71. #    a specific host or from / to a whole subnet (see below)
  72. ;   remote browse sync = 192.168.1.255
  73. # Cause this host to announce itself to local subnets here
  74. ;   remote announce = 192.168.1.255

  75. # Browser Control Options:
  76. # set local master to no if you don't want Samba to become a master
  77. # browser on your network. Otherwise the normal election rules apply
  78. ;   local master = no

  79. # OS Level determines the precedence of this server in master browser
  80. # elections. The default value should be reasonable
  81. ;   os level = 33

  82. # Domain Master specifies Samba to be the Domain Master Browser. This
  83. # allows Samba to collate browse lists between subnets. Don't use this
  84. # if you already have a Windows NT domain controller doing this job
  85. ;   domain master = no

  86. # Preferred Master causes Samba to force a local browser election on startup
  87. # and gives it a slightly higher chance of winning the election
  88. ;   preferred master = yes

  89. # Enable this if you want Samba to be a domain logon server for
  90. # Windows95 workstations.
  91. ;   domain logons = yes

  92. # if you enable domain logons then you may want a per-machine or
  93. # per user logon script
  94. # run a specific logon batch file per workstation (machine)
  95. ;   logon script = %m.bat
  96. # run a specific logon batch file per username
  97. ;   logon script = %U.bat

  98. # Where to store roving profiles (only for Win95 and WinNT)
  99. #        %L substitutes for this servers netbios name, %U is username
  100. #        You must uncomment the [Profiles] share below
  101. ;   logon path = \\%L\Profiles\%U

  102. # All NetBIOS names must be resolved to IP Addresses
  103. # 'Name Resolve Order' allows the named resolution mechanism to be specified
  104. # the default order is "host lmhosts wins bcast". "host" means use the unix
  105. # system gethostbyname() function call that will use either /etc/hosts OR
  106. # DNS or NIS depending on the settings of /etc/host.config, /etc/nsswitch.conf
  107. # and the /etc/resolv.conf file. "host" therefore is system configuration
  108. # dependant. This parameter is most often of use to prevent DNS lookups
  109. # in order to resolve NetBIOS names to IP Addresses. Use with care!
  110. # The example below excludes use of name resolution for machines that are NOT
  111. # on the local network segment
  112. # - OR - are not deliberately to be known via lmhosts or via WINS.
  113. ; name resolve order = wins lmhosts bcast

  114. # Windows Internet Name Serving Support Section:
  115. # WINS Support - Tells the NMBD component of Samba to enable it's WINS Server
  116. ;   wins support = no

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

  120. # WINS Proxy - Tells Samba to answer name resolution queries on
  121. # behalf of a non WINS capable client, for this to work there must be
  122. # at least one    WINS Server on the network. The default is NO.
  123. ;   wins proxy = no

  124. # DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names
  125. # via DNS nslookups. The built-in default for versions 1.9.17 is yes,
  126. # this has been changed in version 1.9.18 to no.
  127.     dns proxy = no

  128. # Case Preservation can be handy - system default is _no_
  129. # NOTE: These can be set on a per share basis
  130. ;  preserve case = no
  131. ;  short preserve case = no
  132. # Default case is normally upper case for all DOS files
  133. ;  default case = lower
  134. # Be very careful with case sensitivity - it can break things!
  135. ;  case sensitive = no

  136. #============================ Share Definitions ==============================
  137.     idmap uid = 16777216-33554431
  138.     idmap gid = 16777216-33554431
  139.     template shell = /bin/false
  140.     winbind use default domain = no
  141. ;    encrypt passwords = yes
  142. ;    guest ok = no
  143. ;    guest account = nobody
  144. ;    security = user
  145. ;    encrypt passwords = yes
  146.     guest ok = yes
  147.     guest account = zeke
  148. ;    security = user
  149.     username map = /etc/samba/smbusers
  150. ;    security = user
  151. ;    encrypt passwords = yes
  152. ;    encrypt passwords = yes
  153. ;    encrypt passwords = yes
  154. ;    encrypt passwords = yes
  155. [homes]
  156.     comment = Home Directories
  157.     browseable = no
  158.     writeable = yes

  159. # Un-comment the following and create the netlogon directory for Domain Logons
  160. ; [netlogon]
  161. ;   comment = Network Logon Service
  162. ;   path = /home/netlogon
  163. ;   guest ok = yes
  164. ;   writable = no
  165. ;   share modes = no


  166. # Un-comment the following to provide a specific roving profile share
  167. # the default is to use the user's home directory
  168. ;[Profiles]
  169. ;    path = /home/profiles
  170. ;    browseable = no
  171. ;    guest ok = yes


  172. # NOTE: If you have a BSD-style print system there is no need to
  173. # specifically define each individual printer
  174. [printers]
  175.     comment = All Printers
  176.     path = /var/spool/samba
  177.     browseable = no
  178. # Set public = yes to allow user 'guest account' to print
  179. ;    guest ok = no
  180. ;    writeable = no
  181.     printable = yes

  182. # This one is useful for people to share files
  183. ;[tmp]
  184. ;   comment = Temporary file space
  185. ;   path = /tmp
  186. ;   read only = no
  187. ;   public = yes

  188. # A publicly accessible directory, but read only, except for people in
  189. # the "staff" group
  190. ;[public]
  191. ;   comment = Public Stuff
  192. ;   path = /home/samba
  193. ;   public = yes
  194. ;   read only = yes
  195. ;   write list = @staff

  196. # Other examples.
  197. #
  198. # A private printer, usable only by fred. Spool data will be placed in fred's
  199. # home directory. Note that fred must have write access to the spool directory,
  200. # wherever it is.
  201. ;[fredsprn]
  202. ;   comment = Fred's Printer
  203. ;   valid users = fred
  204. ;   path = /homes/fred
  205. ;   printer = freds_printer
  206. ;   public = no
  207. ;   writable = no
  208. ;   printable = yes

  209. # A private directory, usable only by fred. Note that fred requires write
  210. # access to the directory.
  211. ;[fredsdir]
  212. ;   comment = Fred's Service
  213. ;   path = /usr/somewhere/private
  214. ;   valid users = fred
  215. ;   public = no
  216. ;   writable = yes
  217. ;   printable = no

  218. # a service which has a different directory for each machine that connects
  219. # this allows you to tailor configurations to incoming machines. You could
  220. # also use the %u option to tailor it by user name.
  221. # The %m gets replaced with the machine name that is connecting.
  222. ;[pchome]
  223. ;  comment = PC Directories
  224. ;  path = /usr/pc/%m
  225. ;  public = no
  226. ;  writable = yes

  227. # A publicly accessible directory, read/write to all users. Note that all files
  228. # created in the directory by users will be owned by the default user, so
  229. # any user with access can delete any other user's files. Obviously this
  230. # directory must be writable by the default user. Another user could of course
  231. # be specified, in which case all files would be owned by that user instead.
  232. ;[public]
  233. ;   path = /usr/somewhere/else/public
  234. ;   public = yes
  235. ;   only guest = yes
  236. ;   writable = yes
  237. ;   printable = no

  238. # The following two entries demonstrate how to share a directory so that two
  239. # users can place files there that will be owned by the specific users. In this
  240. # setup, the directory should be writable by both users and should have the
  241. # sticky bit set on it to prevent abuse. Obviously this could be extended to
  242. # as many users as required.
  243. ;[myshare]
  244. ;   comment = Mary's and Fred's stuff
  245. ;   path = /usr/somewhere/shared
  246. ;   valid users = mary fred
  247. ;   public = no
  248. ;   writable = yes
  249. ;   printable = no
  250. ;   create mask = 0765


  251. [share]
  252.     comment = Zeke'sLinuxShare
  253.     path = /home/zeke/Shares
  254.     writeable = yes
  255.     browseable = yes
  256.     guest ok = yes
  257.     guest only = Yes
  258. [tmp]
  259.     comment = Temporary file space
  260.     path = /tmp
  261.     read only = no
  262.     public = yes
  263.     guest only = Yes
复制代码
发表于 2005-10-25 10:37:09 | 显示全部楼层
把来宾用户改成SHARE试试,应该可以,因为是家庭,可以做成无防护,不用做用户权限,所以直接给个SHARE!!!
回复 支持 反对

使用道具 举报

发表于 2005-10-25 10:50:39 | 显示全部楼层
要把windows的guest用户映射成linux的nobody,用samba下的用户管理工具创建。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表