Joe's picture

I have set up a virtual turnkey lamp server on virtualbox.  I have gotten everything to work as desired except samba.  The server shows up on my network on my W7 machine, however when I connect it just keeps asking for a user/password.  My W7 user/password is set the same as my linux and samba accounts, but the samba share will not take it or any other one I use.  I know the linux user name an pw are correct because I am able to login with it via ssh.  Here's what I have tried:

  • Purge and reinstall samba.
  • Configure samba via webmin.
  • Configure samba via ssh.
  • Verified samba and linux file permissions
  • Tried multiple config

The hast server is Ubuntu 12.04 and samba is installed and works flawlessly. 

The virtual server was setup using the turnkey-lamp-12.0-squeeze-x86 build.

I have spent hours configuring/reconfiguring this and nothing works.  Any help or suggestions would appreciated.

I have attached the smb.conf file.

Update: if I set security type to 'Share level' and fully open all the permissions (777), I can access the share (www).  However, this is not the desired setup, I'd really prefer user level access.

Jeremy Davis's picture

But I do remember wrestling with it ages ago, then I ditched Windows and just used SSHFS (solved all my issues...! :D)

A few things come to mind, firstly have you checked the Samba log to see if there are any hints there on what the issue may be?

Second and third come from a quick browse of your conf (to be clear though, this is the first time I've had a good look at it, I always just used Webmin...). Second is perhaps you should try turning off password encryption just to see if you can pinpoint the caause of your issues. Third is that comparing the last 3 entries, home folders aren't browseable, perhaps this is how you want it, but again, perhaps allow access to home folders to see if it the share that is the issue or the user..., also www doesn't have any declaration about users, permissions, etc - I don't know but I suspect that may be problematic?! (so just guessing really...)

Joe's picture

Jeremy, thanks for the reply.  I will try your suggestions, don't have time an the moment.  I have tried the configuration via webmin, but got the same results.  I have also tried the same basic config that is on the host machine (works), but it won't work on tkl virtual machine.  For now I have it working with 'Share level' set and all the perms open.  Since this is on a private dev network, I'm not as conserned, I just hate not solving the issue.  When I have time to t/s some more, I will post the results.

I'll also look into SSHFS.

Thanks again.

Hendrick's picture

I am new to Linux, just been using Linux for several months but I managed to install Samba server on my local network with Ubuntu server 12.

Based on my experience Samba will not accept your OS user name and password. Samba will accept your username and password only if you have added it to smbpasswd, in other words if your user name and password is not added, you will not able to access any files. You may add your OS user name and password or different user name and password. It is there for security reason otherwise anybody with his own username and password can access Samba.

It would be easier to configure this from CLI. 

I would suggest you first add all usernames and passwords to smbpasswd, then change the owners and groups of  files to be accessed by the users. After this is done, you can configure smb.conf

After the configuration, test it from the CLI using testparm

Good luck!

Joe's picture

Hendrick, thanks for your reply.  I have indeed added the user accounts to both linux and samba.  I matched all 3, local machine, linux, and samba credentials.  Access is seamless on the host ubuntu system (I am not prompted, as the local W7 machine passes through user/pw).  However on the TKL guest (debian 6), this doen't work, I'm continually prompted.

Joe's picture

After my last reply, I played a little more and some how it works now, but not exaclty sure what fixed it.

  • Tried to run testparm from Hendrick's post, it was not recognized, so I had to install samba-common-bin
  • Re-ran config via webmin - at first was getting no access after password (was different response at least)
  • Played with config setting trying a couple options, like share level vs user level, turning off pw encrypt, etc
  • Ran another pass through config,  reset passwords (yet again), restarted server...
  • volia - it worked - new config below (stripped of comments).

Thanks for everyones help.

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

 log file = /var/log/samba/log.%m
 read raw = no
 write raw = no
 passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
 obey pam restrictions = yes
 passdb backend = tdbsam
 passwd program = /usr/bin/passwd %u
 dns proxy = no
 netbios name = neo
 server string = %h server
 unix password sync = yes
 workgroup = cft
 os level = 20
 debug level = 1
 syslog = 0
 security = user
 panic action = /usr/share/samba/panic-action %d
 max log size = 1000
 pam password change = yes

#======================= Share Definitions =======================
 comment = Home Directories
 writeable = yes
 valid users = %S
 create mode = 0700
 directory mode = 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
 writable = yes
 path = /home/samba-share/allusers
 force group = users
 comment = All Users
 valid users = @users
 create mode = 0770
 directory mode = 0771
 delete readonly = yes
 writeable = yes
 path = /var/www
 force directory mode = 775
 force group = www-data
 force create mode = 775
 force user = www-data
 comment = neo web root
 create mode = 775
 directory mode = 775
Joe's picture

It appears the issue was actually resolved with the samba-commons-bin install.  I had another guest that was cloned so it was exacly the same.  When I copied the config to that server it still didn't work until I did the  samba-commons-bin install.  I didn't realize it was required.

Add new comment