> 用samba可以看到机器,但是无法浏览文件,急!!!!!

yankk 2001-11-30 02:55:37
我使用samba 可以从windows 机器中看到linux机器的图标,但是奠击却出现说“找不到计算机或共享名”,真是头疼:(
有人知道怎么办么?
我共享的是/tmp
下面是我的smb.conf,请帮个忙看看,谢谢
# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options (perhaps too
# many!) most of which are not shown in this example
#
# Any line which starts with a ; (semi-colon) or a # (hash)
# is a comment and is ignored. In this example we will use a #
# for commentry and a ; for parts of the config file that you
# may wish to enable
#
# NOTE: Whenever you modify this file you should run the command "testparm"
# to check that you have not many any basic syntactic errors.
#
#======================= Global Settings =====================================
[global]

# workgroup = NT-Domain-Name or Workgroup-Name
workgroup = workgroup
netbios name = msx

# server string is the equivalent of the NT Description field
server string =msx loves yhf

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

# if you want to automatically load your printer list rather
# than setting them up individually then you'll need this
printcap name = /etc/printcap
load printers = no

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

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

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

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

# Security mode. Most people will want user level security. See
# security_level.txt for details.
security = share
# Use password server option only with security = server or
# security = domain
; password server =

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

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

# The following is needed to keep smbclient from spouting spurious errors
# when Samba is built with support for SSL.
ssl CA certFile = /usr/share/ssl/certs/ca-bundle.crt

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

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

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

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

# Configure Samba to use multiple interfaces
# If you have multiple network interfaces then you must list them
# here. See the man page for details.
; interfaces = 192.168.12.2/24 192.168.13.2/24

# Configure
# dependant. This parameter is most often of use to prevent DNS lookups
# in order to resolve NetBIOS names to IP Addresses. Use with care!
# The example below excludes use of name resolution for machines that
are NOT
# on the local network segment
# - OR - are not deliberately to be known via lmhosts or via WINS.
; name resolve order = wins lmhosts bcast

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

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

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

# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names

# via DNS nslookups. The built-in default for versions 1.9.17 is yes,
# this has been changed in version 1.9.18 to no.
dns proxy = no

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

#============================ Share Definitions
==============================
[homes]
comment = Home Directories
browseable = yes
writable = no

# Un-comment the following and create the netlogon directory for Domain
Logons
; [netlogon]
; comment = Network Logon Service
; path = /home/netlogon
; guest ok = yes
; writable = no
; share modes = no


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


# NOTE: If you have a BSD-style print system there is no need to
# specifically define each individual printer
[printers]
comment = All Printers
path = /var/spool/
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
# Set public = yes to allow user 'guest account' to print
guest ok = no
printable = yes

# This one is useful for people to share files
;[tmp]
; comment = Temporary file space
; path = /tmp
; read only = no
; public = yes

# A publicly accessible directory, but read only, except for people in
# the "staff" group
[public]
comment = Public Stuff
path = /mnt
public = yes
writable = no
printable = no
write list = @staff

# Other examples.
#
# A private printer, usable only by fred. Spool data will be placed in
fred's
# home directory. Note that fred must have write access to the spool
directory,
# wherever it is.
;[fredsprn]
; comment = Fred's Printer
; valid users = fred
; path = /homes/fred
; printer = freds_printer
; public = no
; printable = yes

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

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

# A publicly accessible directory, read/write to all users. Note that
all files
# created in the directory by users will be owned by the default user,
so
# any user with access can delete any other user's files. Obviously this

# directory must be writable by the default user. Another user could of
course
# be specified, in which case all files would be owned by that user
instead.
[public]
comment =public files
public = yes
path = /tmp
borowseable = yes
writable = yes
printable = no

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

...全文
118 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
sta_gz 2002-01-16
  • 打赏
  • 举报
回复
先看能不能PING通,这个很重要,如果可以,你已成功了一半。
另,我这边试过了,有安装的时候,如果在安全级别中,设为中级或高级,那是不行的,就算smb.conf设得再正确,都会报找不到主机。
zh8p 2002-01-15
  • 打赏
  • 举报
回复
host allow 先注释掉,guset 先ok了。实现了这一步,再进行其它配置。
一. Samba 简介 Samba(SMB是其缩写) 是一个网络服务器,用于Linux和Windows共享文件之用;Samba 即可以用于Windows和Linux之间的共享文件,也一样用于Linux和Linux之间的共享文件;不过对于Linux和Linux之间共享文件有更好的网络文件系统NFS,NFS也是需要架设服务器的; 大家知道在Windows 网络中的每台机器即可以是文件共享的服务器,也可以同是客户机;Samba 也一样能行,比如一台Linux的机器,如果架了Samba Server 后,它能充当共享服务器,同时也能做为客户机来访问其它网络中的Windows共享文件系统,或其它Linux的Sabmba 服务器; 我们在Windows网络中,看到共享文件功能知道,我们直接就可以把共享文件夹当做本地硬盘来使用。在Linux的中,就是通过Samba的向网络中的机器提供共享文件系统,也可以把网络中其它机器的共享挂载在本地机上使用;这在一定意义上说和FTP是不一样的。 二. Samba的几个套件,安装及简单配置 sambasamba-client, samba-common 一句 sudo apt-get install samba samba-client 就能全部装上 启动samba也很简单: sudo /etc/init.d/samba start 设置samba的密码, 可以先添加samba用户, 必须是系统用户。 smbpasswd -a yourname 三. 互访 1)windows访问ubuntu windows访问ubuntu很简单, 先在ubuntu上设置共享目录即可, 鼠标右键点目录,选择sharing options, 够选share this folder,需要的话也可以够选下面的allow write 这时在windows的网络邻居中的网络中查找就能找到共享目录了,通过//host也行 2)ubuntu访问windows 第一种:在ubuntu的网络中直接浏览访问 位置->网络,点击界面中windows网络->workgroup,在workgroup组中就可以看到windows计算机名,双击会弹出输入用户名和密码的对话框,将我们上面设置smb的用户名和密码输入就可以进行访问。 第二种:用ubuntu 系统自带的连接到服务器功能访问 位置->连接到服务器,在服务类型中选择“windows共享”,在服务器中输入windows计算机的ip地址或计算机名,点击连接,这样在系统桌面中就会显示一个连接到windows 计算机的文件卷,里面就是windows计算机的共享目录了。 同样在访问的时候要输入smb的用户名和密码。 第三种:用mount’挂载windows的共享目录到本地磁盘 首先要在ubuntu系统中建立一个挂载点,在这里我们建立的挂在点为 /mnt/wind 同样在保证网络连接正常,且windows中有共享目录的前提下,进行一下操作 以windows的ip为192.168.0.1,共享文件夹为share为例 命令如下: mount -t smbfs –o username=wangyh,password=123456 //192.168.0.1/share /mnt/wind 有是这样在访问的时候会出现中文乱码的问题,这样我们可以按下面命令来执行,可以解决这个问题 mount -o smbfs -o iocharset=uft8,codepage=cp936,clmask=777,fmask=777,userneme=wangyh,password=123456 //192.168.0.1/share /mnt/wind 注解:usename和password都为smb的用户和密码,如果要详细了解mount命令,使用man mount在终端查看详细用法 第四种:使用smbclient 命令 一般来讲先列出所有共享目录,命令如下: smbclient –L //192.168.0.1/ -U yourname 输入smb的密码后,将看到共享目录列表。 假设进入共享目录share,命令如下: smbclient //192.168.0.1/share -U yourname 之后将看到一个smb:> 已经进入了smb模式,有些像ftp,敲help可以查看相关命令,get,put可以下载和上传文件。 五. 小结 以上几步,对于简单使用ubuntu和windows的文件共享于互访已经足够,更详细的资料可以参考:http://linux.vbird.org/linux_server/0370samba.php#server_pkg
《Linux 进程管理》 1 Samba 简介 Samba(SMB是其缩写) 是一个网络服务器,用于Linux和Windows共享文件之用;Samba 即可以用于Windows和Linux之间的共享文件,也一样用于Linux和Linux之间的共享文件;不过对于Linux和Linux之间共享文件有更好的网络文件系统NFS,NFS也是需要架设服务器的; 大家知道在Windows 网络中的每台机器即可以是文件共享的服务器,也可以同是客户机;Samba 也一样能行,比如一台Linux的机器,如果架了Samba Server 后,它能充当共享服务器,同时也能做为客户机来访问其它网络中的Windows共享文件系统,或其它Linux的Sabmba 服务器; 我们在Windows网络中,看到共享文件功能知道,我们直接就可以把共享文件夹当做本地硬盘来使用。在Linux的中,就是通过Samba的向网络中的机器提供共享文件系统,也可以把网络中其它机器的共享挂载在本地机上使用;这在一定意义上说和FTP是不一样的。 Samba 用的netbios协议,如果您用Samba 不成功, Linux与Windows 、Linux 和 Linux 2 Samba 功能和应用范围 Samba 应该范围主要是Windows和Linux 系统共存的网络中使用;如果一个网络环境都是Linux或Unix类的系统,没有必要用Samba,应该用NFS更好一点; 那Samba 能为我们提供点什么服务呢?主要是共享文件和共享打印机; 3 Samba 两个服务器相关启动程序、客户端及服务器配置文件等; 3.1 Samba 有两个服务器,一个是smb,另一个是nmb; smb 是Samba 的主要启动服务器,让其它机器能知道此机器共享了什么;如果不打开nmb服务器的话,只能通过IP来访问,比如在Windows的IE浏览器上打入下面的一条来访问; \\192.168.1.5\共享目录 \\192.168.1.5\opt 而nmb是解析用的,解析了什么呢?就是把这台Linux机器所共享的工作组及在此工作组下的netbios name解析出来; 一般的情况下,在RPM包的系统,如果是用RPM包安装的Samba ,一般可以通过如下的方式来启动Samba服务器; [root@localhost ~]# /etc/init.d/smb start 启动 SMB 服务: [ 确定 ] 启动 NMB 服务: [ 确定 ] 如果停止呢?就在smb后面加stop ;重启就是restart [root@localhost ~]# /etc/init.d/smb stop [root@localhost ~]# /etc/init.d/smb restart 对于所有系统来说,通用的办法就是直接运行smb 和nmb;当然您要知道smb和nmb所在的目录才行;如果是自己编译的Samba ,您应该知道您把Samba放在哪里了; [root@localhost ~]# /usr/sbin/smbd [root@localhost ~]# /usr/sbin/nmbd 查看服务器是否运行起来了,则用下面的命令; [root@localhost ~]# pgrep smbd [root@localhost ~]# pgrep nmbd 关掉Samba服务器,也可以用下面的办法,大多是通用的;要root权限来执行; [root@localhost ~]# pkill smbd [root@localhost ~]# pkill nmbd 3.2 查看Samba 服务器的端口及防火墙; 查看这个有何用呢?有时你的防火墙可能会把smbd服务器的端口封掉,所以我们应该smbd服务器所占用的端口;下面查看中,我们知道smbd所占用的端口是139和445 ; [root@localhost ~]# netstat -tlnp |grep smb tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 10639/smbd tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 10639/smbd 如果您有防火墙,一定要把这两个端口打开。如果不知道怎么打开。可能你和我一样是新手,还是把防火墙规则清掉也行; [root@localhost ~]# iptables -F 或 [root@localhost ~]# /sbin/iptables -F

19,612

社区成员

发帖
与我相关
我的任务
社区描述
系统使用、管理、维护问题。可以是Ubuntu, Fedora, Unix等等
社区管理员
  • 系统维护与使用区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧