I've set up samba on my Ubuntu desktop.

It appears to be something to do with the server. With all user accounts on Ubuntu(except the default one I use all the time) windows isn't able to/doesn't automatically map the network drive.

In other words: I am only able to to automatically map the network drive on windows with only one of the accounts created on Ubuntu.

Edit: I am able to connect using other accounts, I'm just not able to automatically map using those credentials.

I created the users on the server (Ubuntu) with the adduser command:

adduser username

And then used the following two commands:

sudo smbpasswd -a username
sudo smbpasswd -e username

When I connect on windows(7). I go to tools->map network drive. I leave the driver letter as Z and enter the folder field as:


And I select "connect using different credentials". I'm prompted for a network username and password, which I enter and select "remember my credentials".

Details: Windows 7, Ubuntu 12.10

This is a copy of my smb.conf file:

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


## 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 = 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 =======================

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

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

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

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

   comment = Printer Drivers
   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   guest ok = no
;   write list = root, @lpadmin

;   comment = Samba server's CD-ROM
;   read only = yes
;   locking = no
;   path = /cdrom
;   guest ok = yes
;   preexec = /bin/mount /cdrom
;   postexec = /bin/umount /cdrom
  • What's the /etc/samba/smb.conf look like, specifically for the users? – nerdwaller Dec 11 '12 at 22:53
  • Do you mean security? If so, under authentication, security=user is commented out. – Sheldon Dec 11 '12 at 22:57
  • Not what I was asking, but it is smart to have it active (And for restricted users you could have a guest account). But no, I meant overall, what are the settings. Is there anything different in the user setup of the one you can connect with vs. cannot (permissions, smb account, etc.) – nerdwaller Dec 11 '12 at 23:02
  • Ah okay. I'm sorry but you're really going to have to hold my hand and walk me through this. What do you mean by permissions? Where would I find out if they were different? I really don't know where/what I'm looking for to see if they are different in any way. – Sheldon Dec 11 '12 at 23:10
  • 1
    Thanks Sheldon, I am heading home from work in a minute, so I will be in touch in a bit if no-one has helped by then. Looks like we have what we would probably need to figure it out. – nerdwaller Dec 11 '12 at 23:54

I had similar problems sharing a network drive. Worked fine in Linux but gave problems in XP, 7 and VIsta (yes someone was running Vista). For both 7 and Vista, I managed to get it to work by setting it up from the command line instead of the GUI.

So, click on the windows menu => Run => cmd.exe, in the terminal window that opens type:

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

This will map the folder share from the server servername, with the username domainaccount and password password to drive letter Z. /persistent:yes should make it reconnect automatically after rebooting.

  • This almost worked.. but I still had to put in a password before I could connect to the drive. So this doesn't quite work as it won't automatically reconnect. – Sheldon Dec 12 '12 at 17:45
  • You did give the password at the commandline right? – terdon Dec 12 '12 at 17:49
  • Yes I did. It says that the command completed successfully. And afterwards the network drive becomes available. It's only after logging in again that it doesn't automatically connect. – Sheldon Dec 12 '12 at 17:56
  • If I remember correctly, the way I did it was to issue the command above, then connect once specifying the username and pass (from the gui) and clicking the "Remember me" or whatever the equivalent option is. Windows should then remember your credentials for next time. – terdon Dec 12 '12 at 17:59
  • I tried that but it keeps asking. Although I've noticed a notifcation at the bottom that says "Logon failure:unkown user name or bad password" each time I have to enter the network credentials to map the drive. – Sheldon Dec 12 '12 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.