Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there an easy way to have a samba user automatically created whenever a unix user is created? Currently I'm using LDAP. But it is not that easy, and also very difficult to setup. I'm looking for a simpler way.

share|improve this question
how do you create users? – karthick87 Dec 11 '10 at 18:25
i use this command smbldap-useradd johndoe or the way how a normal unix user is created useradd johndoe. Both create samba users automatically, but, the second solution requires the user to first login as a unix user to get the samba user activated. – nixnotwin Dec 12 '10 at 10:42

You can use "smbpasswd -a " to set the users password in the Samba database, without requiring them to log in.

It should be possible to create a simple wrapper script which calls both useradd and smbpasswd -a. Ideally useradd should just have integration for this and call smbpasswd -a for you (perhaps after you've set a configuration option), but we're not quite there yet.

share|improve this answer

Your Answer


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.