samba服务共享访问问题

samba服务共享访问问题

我在虚拟机上安装了redhat9并安装启用了samba服务,在没有接入网络时我使用smbclient -L 127.0.0.1测试,可以看到共享文件。但当
接入网络后,使用自已的IP,smbclient -L 192.168.1.102时出现:
[root@server root]# smbclient -L 192.168.1.102
added interface ip=192.168.1.102 bcast=192.168.1.255 nmask=255.255.255.0
session request to 192.168.1.102 failed (Call returned zero bytes (EOF)
)
session request to 192 failed (Call returned zero bytes (EOF)
)
session request to *SMBSERVER failed (Call returned zero bytes (EOF)
我原以为是Linux系统的防火墙堵住了,就把防火墙关了,并在/etc/hosts.allow中加 all:192.168.1.0/255.255.255.0
smbd:192.168.1.0/255.255.255.0
但结果还是一样。可以PING通外网。和本地网。      
把/etc/samba/smb.conf挂出来      
这个是/etc/samba/smb.conf
[global]
# workgroup = NT-Domain-Name or Workgroup-Name
   workgroup = MYGROUP
# server string is the equivalent of the NT Description field
   server string = Samba Server
;   hosts allow = 192.168.1. 192.168.2. 127.
   printcap name = /etc/printcap
   load printers = yes
   printing = cups
;  guest account = pcguest
   log file = /var/log/samba/%m.log
   max log size = 0
   security = user
;   password server = <NT-Server-Name>
;  password level = 8
;  username level = 8
   encrypt passwords = yes
   smb passwd file = /etc/samba/smbpasswd
;   ssl CA certFile = /usr/share/ssl/certs/ca-bundle.crt
   unix password sync = Yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *New*password* %n\n *Retype*new*password* %n\n

*passwd:*all*authentication*tokens*updated*successfully*
   pam password change = yes
;  username map = /etc/samba/smbusers
;   include = /etc/samba/smb.conf.%m
  obey pam restrictions = yes
   socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
;   interfaces = 192.168.12.2/24 192.168.13.2/24
;   remote browse sync = 192.168.3.25 192.168.5.255
;   remote announce = 192.168.1.255 192.168.2.44
;   local master = no
;   os level = 33
;   domain master = yes
;   preferred master = yes
;   domain logons = yes
;   logon script = %m.bat
;   logon script = %U.bat
;   logon path = \\%L\Profiles\%U
;   wins support = yes
;   wins server = w.x.y.z
;   wins proxy = yes
   dns proxy = no
;  preserve case = no
;  short preserve case = no
;  default case = lower
;  case sensitive = no

#============================ Share Definitions ==============================
[homes]
   comment = Home Directories
   browseable = no
   writable = yes
   valid users = %S
   create mode = 0664
   directory mode = 0775

[printers]
   comment = All Printers
   path = /var/spool/samba
   browseable = no
# Set public = yes to allow user 'guest account' to print
   guest ok = no
   writable = no
   printable = yes

[docs]
    commet = this is a network desk
    path = /opt/network
    public = yes      
[global]段里的这几句修改如下:
复制内容到剪贴板
代码:
......
max log size = 1000
encrypt passwords = yes
smb passwd file = /etc/samba/smbpasswd
unix password sync = Yes
passwd chat = *Enter\snew\sUNIX\spassword:* %n\n *Retype\snew\sUNIX\spassword:* %n\n *password\supdated\ssuccessfully* .
;pam password change = yes
username map = /etc/samba/smbusers
......
其中如果你没有配置pam认证的话,不要打开这句:pam password change = yes
然后再加上smb用户:
复制内容到剪贴板
代码:
#smbpasswd -a smbuser
重启后再试试吧。