29

I was configuring Samba and tried to add a domain user, but it returns this:

failed to add entry for the user student

These are the commands I've done so far:

frigate@frigate-desktop:~$ su 
Password: 
root@frigate-desktop:/home/frigate# nano /etc/samba/smb.conf 
root@frigate-desktop:/home/frigate# groupadd -g 201 machines
root@frigate-desktop:/home/frigate# mkdir -m 0775 /home/ntlogon
root@frigate-desktop:/home/frigate# mkdir /home/samba /home/samba/profiles
root@frigate-desktop:/home/frigate# chmod 1755 /home/samba/profiles/
root@frigate-desktop:/home/frigate# useradd -m test
root@frigate-desktop:/home/frigate# passwd test
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
root@frigate-desktop:/home/frigate# smbpasswd -a test
New SMB password:
Retype new SMB password:
Added user test.
root@frigate-desktop:/home/frigate# smbpasswd -a root
New SMB password:
Retype new SMB password:
Added user root.
root@frigate-desktop:/home/frigate# smbpasswd -a student
New SMB password:
Retype new SMB password:
Failed to add entry for user student.
root@frigate-desktop:/home/frigate# smbpasswd -a student
New SMB password:
Retype new SMB password:
Failed to add entry for user student.
root@frigate-desktop:/home/frigate# smbpasswd -a stu
New SMB password:
Retype new SMB password:
Mismatch - password unchanged.
Unable to get new password.
root@frigate-desktop:/home/frigate# smbpasswd -a stu
New SMB password:
Retype new SMB password:
Failed to add entry for user stu.

How can I add this user to Samba?

Thomas Ward
  • 74,764

2 Answers2

82

You need to create a UNIX user named student before you create a samba user named student.

mmstick
  • 1,907
9

Maybe you did not create it yet. So to add it for the first time to samba need to add the

-a

option

sudo smbpasswd -a test

A samba user is setted and added in a different way than unix users. That means that not because a unix user exists, a samba user exists. The way to add a samba user is setting its password from unix user

Philippe Gachoud
  • 5,900
  • 3
  • 43
  • 50
  • 2
    This actually helped me. There are circumstances where a Unix user can exist and still result in the error. Thanks. – Z. Cochrane May 26 '20 at 15:58
  • 1
    beware, it is not because a unix user exists that it exists into the world of samba! – Philippe Gachoud May 26 '20 at 20:11
  • By my count he used the add command (-a) six times, so the "Maybe you did not create it yet" indicates an inadequate reading of the question. – cedwin Mar 27 '23 at 19:31
  • 1
    @cedwin I answered the question to a more general matter, not only specific so it helps other users as well and seems it did – Philippe Gachoud Apr 15 '23 at 00:01