Samba authentication fails

11,950

Open a terminal and try this:

sudo smbpasswd -a < username>

Here, < username> is your username. Now, you will be prompted to set and retype new password.

Then, restart the smb service:

sudo service smbd restart

Now, try to open the shared location the usual way. Type the username and the new password you have just set.

You should be able to log in now.

Share:
11,950

Related videos on Youtube

Tyler Cox
Author by

Tyler Cox

Updated on September 18, 2022

Comments

  • Tyler Cox
    Tyler Cox over 1 year

    I have been endlessly searching for what went wrong, and can't figure it out. There is a lot that I still don't understand about working with samba on Ubuntu, so if something looks noobish, I am sorry.

    Before I updated my ubuntu server, sharing was acting normal and the teacher account was able to authenticate, when I updated though, it stopped working.

    I'm using Ubuntu server: Distributor ID: Ubuntu Description: Ubuntu 15.10 Release: 15.10 Codename: wily

    and samba: Version 4.1.17-Ubuntu

    When I try to map a network drive from a windows computer (windows 10 in this case, also used windows 7 with similar results), i get the following log results in /var/logs/samba/log.(ip address of windows) :

    check_ntlm_password:  Authentication for user [teacher] -> [teacher] FAILED with error NT_STATUS_NO_SUCH_USER
    [2016/01/06 14:00:51.944975,  3] ../source3/auth/auth_util.c:1593(do_map_to_guest_server_info)
      No such user teacher [HeritageFileServer] - using guest account
    

    From the windows machine I am logging in as HeritageFileServer\teacher, i also tried HERITAGEFILESERVER\teacher, and just teacher, in the past, the first one worked just fine.

    If I type sudo pdbedit -L -v, which as I understand, is supposed to list my samba users, I get this:

    ---------------
    Unix username:        tech
    NT username:          
    Account Flags:        [U          ]
    User SID:             S-1-5-21-3838925055-3536237277-778935331-1000
    Forcing Primary Group to 'Domain Users' for tech
    Primary Group SID:    S-1-5-21-3838925055-3536237277-778935331-513
    Full Name:            Tech
    Home Directory:       \\heritagefileserver\tech
    HomeDir Drive:        
    Logon Script:         
    Profile Path:         \\heritagefileserver\tech\profile
    Domain:               HERITAGEFILESERVER
    Account desc:         
    Workstations:         
    Munged dial:          
    Logon time:           0
    Logoff time:          never
    Kickoff time:         never
    Password last set:    Wed, 06 Jan 2016 13:07:05 MST
    Password can change:  Wed, 06 Jan 2016 13:07:05 MST
    Password must change: never
    Last bad password   : 0
    Bad password count  : 0
    Logon hours         : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
    ---------------
    Unix username:        teacher
    NT username:          
    Account Flags:        [U          ]
    User SID:             S-1-5-21-3838925055-3536237277-778935331-1001
    Forcing Primary Group to 'Domain Users' for teacher
    Primary Group SID:    S-1-5-21-3838925055-3536237277-778935331-513
    Full Name:            
    Home Directory:       \\heritagefileserver\teacher
    HomeDir Drive:        
    Logon Script:         
    Profile Path:         \\heritagefileserver\teacher\profile
    Domain:               HERITAGEFILESERVER
    Account desc:         
    Workstations:         
    Munged dial:          
    Logon time:           0
    Logoff time:          never
    Kickoff time:         never
    Password last set:    Mon, 04 Jan 2016 15:22:14 MST
    Password can change:  Mon, 04 Jan 2016 15:22:14 MST
    Password must change: never
    Last bad password   : 0
    Bad password count  : 0
    Logon hours         : FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
    

    Obviously teacher exists, and the password is very simple, so I'm certain i'm not getting it wrong, I even reset the password to make sure by using smbpasswd.

    I ended up setting the important folders to allow guest accounts so the teachers could access the drive, meanwhile I'm trying to get the log to show that it successfully authenticated. Here is my smb.conf file (I have share and Share as the original folders that are now open to guests, while Shared is my test folder that I am trying to get to work with authentication):

    #======================= Global Settings =======================
    
    [global]
    
    ;workgroup = WORKGROUP
    
    server string = %h server (Samba, Ubuntu)
    
    dns proxy = no
    
    #interfaces = eth0
    
    log level = 3
    
    log file = /var/log/samba/log.%m
    
    max log size = 1000
    
    syslog = 0
    
    
    ####### Authentication #######
    
    ;server role = standalone server
    
    security = user
    
    guest account = nobody
    
    map to guest = bad user
    
    ;usershare allow guests = yes
    
    #======================= Share Definitions =======================
    
     [printers]
    comment = All Printers
    browseable = yes
    path = /var/spool/samba
    printable = yes
    guest ok = yes
    read only = yes
    create mask = 0700
    
    [print$]
    comment = Printer Drivers
    path = /var/lib/samba/printers
    browseable = yes
    read only = yes
    guest ok = yes
    
    [share]
    comment= Heritage File Server
    path = /media/external/ServerBackup
    browsable = yes
    guest ok = yes
    read only = no
    create mask = 0755
    
    [Share]
    comment= Heritage File Server
    path = /media/external/ServerBackup
    browsable = yes
    guest ok = yes
    read only = no
    create mask = 0755
    
    [Shared]
    comment= Heritage File Server
    path = /media/external/ServerBackup
    available = yes
    valid users = teacher
    browsable = yes
    guest ok = no
    read only = no
    writable = yes
    create mask = 0755
    
    [web]
    comment = Heritage Web Hosting
    path = /var/www/html
    browsable = yes
    guest ok = no
    read only = no
    create mask = 0755
    
    [homes]
    comment = Home Directories
    browsable = yes
    read only = yes
    

    Anybody know what is wrong?

  • Tyler Cox
    Tyler Cox about 6 years
    Wish I could test this. At a new job now so I guess I will never find out.
  • Ahsan Tarique
    Ahsan Tarique about 6 years
    Yes, the post is from two years ago. I should have expected that :)
  • siliconrockstar
    siliconrockstar over 4 years
    Fixed my problem, thank you.
  • Ahsan Tarique
    Ahsan Tarique about 4 years
    You can upvote and/or mark this as the accepted answer if it has worked for you :)