重新安装后无法连接到 Samba 共享

重新安装后无法连接到 Samba 共享

我有一个家庭文件服务器,最近在其上重新安装了操作系统。由于硬件升级,我将 Ubuntu Server 10.04.2 32 位替换为 10.04.3 64 位。我复制了之前的 Samba 配置,重新创建了共享用户,并确保另一个磁盘上的共享目录的权限仍然完好无损。我有一台XP和一台Win7机器。两者都可以看到文件服务器,但都无法访问共享。如果我在 Windows 计算机上访问\\Server,它会提示输入用户/密码并似乎接受连接。如果我进入\\Server\Share下一步,它会再次要求用户/密码,并且不会进行身份验证。

Windows 计算机上的网络设置没有更改。服务器是否还缺少其他一些配置?还有什么可能是错误的?

故障排除:我按照建议找到了日志。 smbd 和 nmbd 都在运行。在 Windows 机器的日志中,当我尝试连接时,我收到很多这样的行。

[2011/11/07 07:23:53,  1] smbd/service.c:676(make_connection_snum)
  create_connection_server_info failed: NT_STATUS_ACCESS_DENIED

这显然是问题所在,但我不知道为什么会发生。我使用的用户和通行证都很好,并且在升级之前可以正常工作。我确实在 log.winbindd-idmap 中找到了这个:

[2011/11/07 07:14:12,  1] winbindd/idmap.c:321(idmap_init_domain)
  idmap initialization returned NT_STATUS_UNSUCCESSFUL
[2011/11/07 07:23:40,  0] winbindd/idmap.c:201(smb_register_idmap_alloc)
  idmap_alloc module tdb already registered!
[2011/11/07 07:23:40,  0] winbindd/idmap.c:149(smb_register_idmap)
  Idmap module passdb already registered!
[2011/11/07 07:23:40,  0] winbindd/idmap.c:149(smb_register_idmap)
  Idmap module nss already registered!
[2011/11/07 07:23:40,  1] winbindd/idmap_tdb.c:214(idmap_tdb_load_ranges)
  idmap uid missing
[2011/11/07 07:23:40,  0] winbindd/idmap_tdb.c:287(idmap_tdb_open_db)
  Upgrade of IDMAP_VERSION from -1 to 2 is not possible with incomplete configur
ation
[2011/11/07 07:23:40,  1] winbindd/idmap.c:321(idmap_init_domain)
  idmap initialization returned NT_STATUS_UNSUCCESSFUL

日志文件

[2011/11/06 20:01:29,  0] smbd/server.c:1069(main)
  smbd version 3.4.7 started.
  Copyright Andrew Tridgell and the Samba Team 1992-2009
[2011/11/06 20:01:29,  0] printing/print_cups.c:103(cups_connect)
  Unable to connect to CUPS server localhost:631 - Connection refused
[2011/11/06 20:01:29,  0] printing/print_cups.c:103(cups_connect)
  Unable to connect to CUPS server localhost:631 - Connection refused
[2011/11/06 20:01:29,  0] smbd/server.c:1115(main)
  standard input is not a socket, assuming -D option

对数nmbd

[2011/11/06 13:40:55,  0] nmbd/nmbd.c:854(main)
  nmbd version 3.4.7 started.
  Copyright Andrew Tridgell and the Samba Team 1992-2009

smb.conf,大部分内容都是库存

[global]
   workgroup = MyGroup   # edited
   server string = %h server (Samba, Ubuntu)
   dns proxy = no
   use sendfile = yes   # edited
   log file = /var/log/samba/log.%m
   max log size = 1000
   syslog = 0
   panic action = /usr/share/samba/panic-action %d
   security = user   # edited
   encrypt passwords = true
   passdb backend = tdbsam
   obey pam restrictions = yes
   unix password sync = yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
   pam password change = yes
   map to guest = bad user
   guest account = myshareuser   # edited
   usershare allow guests = yes

[printers]
   comment = All Printers
   browseable = no
   path = /var/spool/samba
   printable = yes
   guest ok = no
   read only = yes
   create mask = 0700

[print$]
   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = no

# added
[share]
path = /mnt/storage/share
force user = myshareuser
force group = myshareuser
read only = No
create mask = 0777
directory mask = 0777
guest only = No
guest ok = No

[backup]
path = /mnt/storage/backup
force user = myshareuser
force group = myshareuser
read only = No
create mask = 0777
directory mask = 0777
guest only = No
guest ok = No

答案1

尝试以下操作:

sudo smbpasswd -L -a username   (set a password)
sudo smbpasswd -L -e username   (enable user)

您还可以添加 /etc/samba/smb.conf 的内容以及问题详细信息。另外,你可以尝试一下webmin。有关详细信息,请查看以下链接:

网络敏

答案2

可能是损坏的 passdb.tdb 文件。如果删除它并重新启动 Samba 可以添加用户吗?

答案3

好的。如果您还没有找到解决方案,请尝试以下操作:

sudo system-config-samba

它会给你一个像这样的图形用户界面:

在此输入图像描述

在此输入图像描述

在此输入图像描述

在此输入图像描述

检查“首选项”框(Samba 设置和 Samba 用户)。您可以从“文件”-->“添加共享”添加共享

此外,如果问题仍然存在,那么您还可以尝试编辑 /etc/samba/smb.conf 文件,如下所示,我想这可能会解决您的问题:

usershare allow guests = yes
security = user
guest ok = yes
guest account = exampleuser 
username map = /etc/samba/smbusers


# added
[share]
path = /mnt/storage/share
valid users = myshareuser
read only = No
guest ok = yes
browseable = yes

[backup]
path = /mnt/storage/backup
valid users = myshareuser
read only = No
guest ok = yes
browseable = yes

然后执行以下命令:

sudo chmdo 777 /mnt/storage/share /mnt/storage/backup
sudo stop smbd
sudo start smbd

现在检查共享是否有效:D

对于交互式用户身份验证,以下可能有效

在系统中添加用户并提供密码

须藤添加用户testamba

将用户添加到 Samba &当再次询问时保留密码为空

sudo smbpasswd -a testsamba

映射 Windows 用户

sudo vi /etc/samba/smbusers

该文件应包含如下内容:

testsamba = windowsuserSample

像以前一样使用 GUI 进行必要的配置

sudo system-config-samba

重新启动桑巴服务

sudo service smbd restart

答案4

@Jay Sheridan,我已经尝试了以下方法,它应该有效。这只是上次回复的摘要版本。你可以检查一下。

  1. 安装 samba 服务器,在终端中输入命令:
sudo apt-get install samba smbfs
  1. 进行共享配置:

sudo vi /etc/samba/smb.conf

像这样编辑:

[global]

security = USER hosts allow =

[homes]

comment = Home Directories

browseable = no

writable = yes

[share]

comment = Unixmen File Server

path = /share/

force user = samba

force group = samba

read only = No

hosts allow =

添加用户(例如:unixmenuser 到系统中,在终端中键入命令:

root@unixmen-desktop:~# adduser unixmenuser

sudo smbpasswd -a unixmenuser

第二个命令的输出应如下所示


Output

New SMB password:

Retype new SMB password:

Added user unixmenuser.

相关内容