2 exec smbscript "$0" ${1+"$@"}
4 add a new user to a Samba4 server
5 Copyright Andrew Tridgell 2005
6 Released under the GNU GPL v2 or later
9 options = new Object();
10 ok = GetOptions(ARGV, options,
13 "POPT_COMMON_VERSION",
19 println("Failed to parse options: " + options.ERROR);
23 libinclude("base.js");
24 libinclude("provision.js");
28 print a message if quiet is not set
32 if (options["quiet"] == undefined) {
33 print(vsprintf(arguments));
46 --username USERNAME choose new username
47 --unixname USERNAME choose unix name of new user
48 --password PASSWORD set password
50 You must provide at least a username
55 if (options['username'] == undefined) {
58 if (options['password'] == undefined) {
59 options.password = randpass(12);
60 printf("chose random password %s\n", options.password);
62 if (options['unixname'] == undefined) {
63 options.unixname = options.username;
67 if (nss.getpwnam(options.unixname) == undefined) {
68 printf("ERROR: Unix user '%s' does not exist\n", options.unixname);
72 newuser(options.username, options.unixname, options.password, message);