[Samba] samba-tool create user

Mark Nienberg mnlists at tippingstructural.com
Wed Apr 19 23:06:52 UTC 2017


I'm working on a shell script to create new users on a AD DC. Currently we
use ADUC, but that is slow and error-prone. My (untested) command looks
like this:

samba-tool user create $USERNAME $PASSWORD \
--nis-domain=sta \
--unix-home=/home/${USERNAME} \
--uid-number=${NEXTID} \
--login-shell=/sbin/nologin \
--gid-number=513 \
--use-username-as-cn \
--home-drive=Z \
--home-directory=\\\\gecko\\${USERNAME} \
--profile-path=\\\\gecko\\profiles\\${USERNAME} \
--userou='OU=users,OU=tipping'

I'm not sure I am using the "--userou" correctly. We store our active users
in a separate users OU within one named for our domain, so if I look at the
distinguishedName attribute for a current user in ADUC it looks like this:

CN=adrian,OU=users,OU=tipping,DC=tipping,DC=lan

The man page says this:

--userou=USEROU       DN of alternative location (without domainDN
counterpart) to default CN=Users in which new user object will be created.
E.g. 'OU=<OU name>'

If I get it wrong, will the command just fail or will it try to create some
incorrect OU that I will then have to figure out how to clean up? Do you
think I guessed correctly?

Also, did I get the (doubled) backslashes right in the windows paths?

And should the home-drive be 'Z' or 'Z:'?

I guess a working example would help a lot for the parameters that are not
in any examples in "samba-tool user create --help". Thanks,


More information about the samba mailing list