TurnKey Linux Virtual Appliance Library

Samba cannot connect

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.

Attached: 
Jeremy's picture

I don't know much about Samba...

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...)

Thanks

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.

Linux and Samba Accounts

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!


Hendrick, thanks for your

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.

Not exactly sure how, but it's working...

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

[global]
 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 =======================
[homes]
 comment = Home Directories
 writeable = yes
 valid users = %S
 create mode = 0700
 directory mode = 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
[allusers]
 writable = yes
 path = /home/samba-share/allusers
 force group = users
 comment = All Users
 valid users = @users
 create mode = 0770
 directory mode = 0771
[www]
 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
 

And the winner is...

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.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)