为什么网络驱动器没有自动连接?

为什么网络驱动器没有自动连接?

我已经在我的 Ubuntu 桌面上设置了 samba。

这似乎与服务器有关。Ubuntu 上的所有用户帐户(我一直使用的默认帐户除外)都无法/不会自动映射网络驱动器。

换句话说:我只能使用在 Ubuntu 上创建的一个帐户自动映射 Windows 上的网络驱动器。

编辑:我可以使用其他帐户进行连接,但无法使用这些凭据自动映射。

我使用 adduser 命令在服务器(Ubuntu)上创建了用户:

adduser username

然后使用了以下两个命令:

sudo smbpasswd -a username
sudo smbpasswd -e username

当我在 Windows(7) 上连接时。我转到工具->映射网络驱动器。我将驱动器号保留为 Z,并输入文件夹字段如下:

\\servername\username

然后我选择“使用不同的凭据连接”。系统提示我输入网络用户名和密码,我输入后选择“记住我的凭据”。

详细信息:Windows 7、Ubuntu 12.10

这是我的 smb.conf 文件的副本:

#======================= Global Settings =======================

[global]

## Browsing/Identification ###
   workgroup = WORKGROUP
   server string = %h server (Samba, Ubuntu)
#   wins support = no
;   wins server = w.x.y.
   dns proxy = no
;   name resolve order = lmhosts host wins bcast

#### Networking ####
;   interfaces = 127.0.0.0/8 eth0
;   bind interfaces only = yes

#### Debugging/Accounting ####
   log file = /var/log/samba/log.%m
   max log size = 1000
#   syslog only = no
   syslog = 0
   panic action = /usr/share/samba/panic-action %d

####### Authentication #######
   security = user
   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

########## Domains ###########
;   domain logons = yes
;   logon path = \\%N\profiles\%U
#   logon path = \\%N\%U\profile
;   logon drive = H:
#   logon home = \\%N\%U
;   logon script = logon.cmd
; add user script = /usr/sbin/adduser --quiet --disabled-password --gecos "" %u
; add machine script  = /usr/sbin/useradd -g machines -c "%u machine account" -d /var/lib/samba -s /bin/false %u
; add group script = /usr/sbin/addgroup --force-badname %g

########## Printing ##########
#   load printers = yes
;   printing = bsd
;   printcap name = /etc/printcap
;   printing = cups
;   printcap name = cups

############ Misc ############
;   include = /home/samba/etc/smb.conf.%m

# You may want to add the following on a Linux system:
#         SO_RCVBUF=8192 SO_SNDBUF=8192
#   socket options = TCP_NODELAY
;   message command = /bin/sh -c '/usr/bin/linpopup "%f" "%m" %s; rm %s' &
#   domain master = auto
;   idmap uid = 10000-20000
;   idmap gid = 10000-20000
;   template shell = /bin/bash
;   winbind enum groups = yes
;   winbind enum users = yes
;   usershare max shares = 100
   usershare allow guests = yes

#======================= Share Definitions =======================

[homes]
   comment = Home Directories
   browseable = yes
   read only = no
;   create mask = 0700
;   directory mask = 0700
;   valid users = %S

;[netlogon]
;   comment = Network Logon Service
;   path = /home/samba/netlogon
;   guest ok = yes
;   read only = yes

;[profiles]
;   comment = Users profiles
;   path = /home/samba/profiles
;   guest ok = no
;   browseable = no
;   create mask = 0600
;   directory mask = 0700

[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
;   write list = root, @lpadmin

;[cdrom]
;   comment = Samba server's CD-ROM
;   read only = yes
;   locking = no
;   path = /cdrom
;   guest ok = yes
;   preexec = /bin/mount /cdrom
;   postexec = /bin/umount /cdrom

答案1

我在共享网络驱动器时也遇到过类似的问题。在 Linux 中运行良好,但在 XP、7 和 VIsta 中出现问题(是的,有人在运行 Vista)。对于 7 和 Vista,我设法通过从命令行而不是 GUI 进行设置来使其正常工作。

因此,单击 Windows 菜单 => 运行 => cmd.exe,在打开的终端窗口中输入:

net use z: /persistent:yes \\servername\share /u:domainaccount password

share这会将服务器上的文件夹servername以及用户名domainaccount和密码映射password到驱动器号Z/persistent:yes应使其在重启后自动重新连接。

相关内容