Samba config - failed to add entry for user - Raspberry Pi

I attempted to create a shared folder on a raspberry pi using the instructions found here. On running the command "sudo smbpasswd -a pi" to create a user and add a password, I got an error "Failed to add entry for user pi". Changing the user name to something else or trying different passwords did not make the error go away.

While I did not confirm this, I suspect the same error shows up in Ubuntu as well. However the solution there was not super clear.

2 Answers

It turns out that the error message from smbpasswd is not super clear. Also the man page for smbpasswd can be misleading as the -a option seems to suggest that this option will add the user and create a password for that user.

The underlying issue seems to be that smbpasswd only adds users/sets passwords for users already known to the OS. So the right sequence of steps would be:

sudo useradd pi
sudo passwd pi
sudo smbpasswd -a pi

as detailed here.

A closer reading of the smbpasswd man page with this knowledge shows that what smbpasswd does is make changes to the smbpasswd file and not the main password file of the OS.

1

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

1. adduser student
2. smbpasswd -a student

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like