Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

So I should start by saying that I did this successfully less than a week ago and I had no trouble but I have since reformatted and reconfigured my server and now I'm having the hardest time remembering how I did it.

Here's what I had before and what I am trying to accomplish again. I had a public samba share on Ubuntu server. Anyone on my network could access the share and it's contents simply by typing \Hostname. No password necessary. Users who were not on the share's workgroup had read access but users who were on the workgroup had read/write access. (Windows 7)

Now, if I try to connect to \Hostname I'm prompted for a username and password. If I enter the un pw I get full access but I shouldn't have to; my current settings are...

security = user
map to guest = bad user

[Shares]
path = /home/shares
available = yes
read only = no
browsable = yes
public = yes
writable = yes
guest ok = yes

I'm pulling my hair out over this one. Any suggestions?

EDIT:

Ugh, this is giving me such a hard time. I'm so close.

Here's what I've got.

I can get to the share from Windows 7 by going to start and typing \Hostname\Sharename but I'm prompted for a username and password. I cant just leave it blank though because it will use my workgroup as the domain; so I enter \ for the username to clear it out and log in with a blank username and password. Great now I can access the files in the share.

Once I'm in, The workgroup configuration is working properly. If I'm on a computer with the the default WORKGROUP I can read and execute; a computer on my Home workgroup can read write and execute. So that's working.

The problem is, It shouldn't be asking for a password at all. It should be totally public to anyone on the network. I'm trying to share it with XBMC and it's not even showing up under smb in the file manager. I cant access it manually from XBMC either. I get a connection refused error.

Still pulling hair out over this. The worst part is the first time I did this about a week ago, I spent about 30 minutes on it and it worked perfectly. Now I've probably spent at least 4 hours and it's still not working.

Testparm:

Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[printers]"
Processing section "[print$]"
Processing section "[Shares]"
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions

[global]
        workgroup = FELLOWSHIP
        server string = %h server (Samba, Ubuntu)
        map to guest = Bad User
        obey pam restrictions = Yes
        pam password change = Yes
        passwd program = /usr/bin/passwd %u
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        unix password sync = Yes
        syslog = 0
        log file = /var/log/samba/log.%m
        max log size = 1000
        socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
        dns proxy = No
        wins support = Yes
        usershare allow guests = Yes
        panic action = /usr/share/samba/panic-action %d
        idmap config * : backend = tdb

[printers]
        comment = All Printers
        path = /var/spool/samba
        create mask = 0700
        printable = Yes
        print ok = Yes
        browseable = No

[print$]
        comment = Printer Drivers
        path = /var/lib/samba/printers

[Shares]
        path = /home/shares
        read only = No
        guest ok = Yes

UPDATE: So, the share is now available across my network regardless of the work group. Any Windows user who connects to my network can see the NAS under Netowork and access it. The key was setting security to security = share. I know, it's deprecated, but it works and security = user and map to user = bad user wasn't working for me.

Anyway, now it seems that anyone who connects to the share get's unix global permissions for the directory, which is manageable, but I want users that are joined to the workgroup specified in smb.conf to get unix group permissions.

This way, I can set the directory to 775 and I will be able to write because I am joined to the workgroup but other users can only read and execute.

share|improve this question
    
You should be able to map workgroup users to get specific permissions with a username map file: samba.org/samba/docs/man/manpages-3/smb.conf.5.html#USERNAMEMAP –  BryceAtNetwork23 Mar 19 '13 at 14:29
add comment

1 Answer

Happened to stumble across this thread on the Ubuntu forums, and thought it might help. It explains the steps that happen behind the scenes:

In Windows the client's username and password is automatically sent when it browses for shares - this is done without the user's knowledge. That forces Samba to deal with the sent credentials even though it's a guest share that requires no authentication.

When that username is passed Samba will search through it's password database for that user:

  • If there is no match to the username the client user is tagged a "Bad User" and converted ( mapped ) to the guest account which by default is "nobody".

  • If it finds a match to the username and there is a samba password that matches the one sent by the Windows client then the Windows user automatically gains access although not as an anonymous user which is why you needed to add "force user = nobody" to your share definition.

  • If it finds a match to the username but the samba password does not match exactly the password that's automatically sent by the Windows client then you will be prompted for a password - even for a guest share.

Try adding force user = nobody to your share definition, and see if that does it.

Edit 02/20/2013:

Is testparm returning an exit code of something other than zero? All the same, I would go ahead and give that area of the config a good, hard look. Also, I'm not sure how case-sensitive smb.conf is, but every example I see (for example) of map to guest = Bad User has the B and U capitalized. Check-out the Samba man pages for the options you are using, and double-check everything.

share|improve this answer
    
Hey Bryce, Thanks for answering. I've managed to make a little progress since my original question but I'm still essentially having the same issue. I've managed to get my share (I'm calling it Shares) configured so that anyone on the workgroup, defined in the global seettings in smb.conf, can get right to it - No password necessary. Continuing in next comment... –  George Spake Feb 20 '13 at 5:01
    
Here are the settings for the share: [Shares] path = /home/shares browsable = yes available = yes read only = no public = yes writable = yes guest ok = yes If I add force user = nobody it breaks and I can't access the share at all. Here's where it get's weird though; when I run testparm it dumps [Shares] path = /home/shares read only = no guest ok = yes So for some reason it's like it isn't seeing the public, writeable, available and browseable definitions. Could this be an indicator of where the problem is. –  George Spake Feb 20 '13 at 5:03
    
@GeorgeSpake edit made... –  BryceAtNetwork23 Feb 20 '13 at 15:54
    
I think testparm just spits stuff out that way. Everything is lowercase in the conf file. I also discovered, and I need to verify this, that testparm only dumps non-default definitions which would explain why some of the results are omitted. –  George Spake Feb 21 '13 at 1:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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