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.

I have a strange problem, which I have found no answers for on the web.

I have ubuntu 12.04 LTS with Samba 3.6. 3 (ntp krb5-user smbfs smbclient winbind)

At first everything works fine, groups in AD have the proper file access and user permissions work, except for one anomaly:

There are 2 users with the same first name:

simon folly and simon wally

If I log into Windows as simon wally and try to access his share I get permission denied. When I view samba.log is states:

[2014/03/24 20:39:04.702632, 2] smbd/service.c:627(create_connection_session_info) user 'WINDOMAIN\simon folly' (from session setup) not permitted to access this share (simonw)

As you can see above the wrong username is been authenticated. It's seems it finds the first name from the list and picks that one.

So to test my theory I changed the username in the smb.conf file to "simon folly" and sure enough when logged in as simon wally I have full access to my share ??

Has this happened to anyone and how to fix it ?

Here is my share in smb.conf

note: when I change wally to folly then wally has full access.
otherwise below gets denied.    

[simonw]
    comment = Simon Only
    path = /sharing/ceo
    valid users = "WINDOMAIN\simon wally"
    force group = "domain users"
    writable = yes
    read only = no
    force create mode = 0660
    create mask = 0777
    directory mask = 0777
    force directory mode = 0770
    access based share enum = yes
    hide unreadable = yes

thank you in advance for your help :)

share|improve this question
    
I think you are not allowed to use quotes for valid users. It should be a comma separated list of usernames, like: valid users = username1, username2, username3 .... Take a look at this for more information. –  hmayag Mar 24 at 13:05

1 Answer 1

This problem is caused by the lack of support for spaces inside user names with samba, because spaces are used as name separator and are not default.

The following solution can be used to solve this problem, this creates an alias for the user name with spaces:

  1. Define a user name map by placing the following inside your samba configuration:

    username map = /usr/local/private/usermap.txt
    
  2. Add the following content to /usr/local/private/usermap.txt

    WINDOMAIN\simonwally = "WINDOMAIN\simon wally"
    WINDOMAIN\simonfolly = "WINDOMAIN\simon folly"
    

    This creates an alias, so the name can be the user without spaces

  3. Change the valid users section inside your configuration to:

    valid users = "WINDOMAIN\simonwally"
    

    So it picks up the correct user

  4. Check if the samba configuration contains mistakes (always recommend after a modification) Run the following code on a terminal like bash:

    testparm
    if [ $? -eq 0 ]; then
    echo "Syntax OK"
    else
    echo "Syntax Error"
    fi
    
  5. Restart samba:

    sudo service smbd restart
    

Ref 1: Explains how to use spaces inside the configuration.

Ref 2: Code for checking if the samba configuration contains mistakes.

share|improve this answer

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.