Subject: Re: NetBSD, Samba & PDC
To: None <emre@vsrc.uab.edu>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: netbsd-users
Date: 10/15/2002 22:39:49
--tKW2IUtsqtDRztdT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Tue, Oct 15, 2002 at 11:12:43AM -0500, emre@vsrc.uab.edu wrote:
> Hi folks,
> 
> I'm trying to setup a primary domain controller using samba and netbsd. 
> Unfortunately, netbsd will not let me add 'machine' account names.  I'm
> trying to do:
> 
> useradd -g machines -c WINDESKTOP -d /dev/null -s /bin/false 'windesktop$'
> 
> It complains about windesktop$ not being a valid login name.  According to
> this tutorial I'm using, I have to have a $ after the login name.  This is
> just for setting up "trust accounts".  Has anyone else set up a PDC using
> netbsd and samba?  if so, I'd be very happy to see some suggestions or
> possibly some tricks, especially on how to automate the whole user
> administration process :)

I have a useradd modified to allow this, and also to be called from samba,
so that a machine can add itselfs to the domain if the admins doing
it knows the root passwd (mandatory for windows 2000). I added to my smb.conf:
   add user script = /usr/local/adm/smb_useradd -d /nonexistent -c "%m account" -p "*************" %m$
    domain admin group = root

I also changed it to read be called smb_useradd and read
/usr/local/adm/smb_useradd.conf as config file.

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
--

--tKW2IUtsqtDRztdT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

Index: main.c
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/user/main.c,v
retrieving revision 1.1
diff -u -r1.1 main.c
--- main.c	1999/12/24 09:08:50	1.1
+++ main.c	2002/10/15 20:39:27
@@ -51,27 +51,7 @@
 
 /* despatch table for commands */
 static cmd_t	cmds[] = {
-	{	1,	{ "useradd",	NULL },		useradd		},
-	{	2,	{ "user",	"add" },	useradd		},
-	{	1,	{ "usermod",	NULL },		usermod		},
-	{	2,	{ "user",	"mod" },	usermod		},
-	{	1,	{ "userdel",	NULL },		userdel		},
-	{	2,	{ "user",	"del" },	userdel		},
-#ifdef EXTENSIONS
-	{	1,	{ "userinfo",	NULL },		userinfo	},
-	{	2,	{ "user",	"info" },	userinfo	},
-#endif
-	{	1,	{ "groupadd",	NULL },		groupadd	},
-	{	2,	{ "group",	"add" },	groupadd	},
-	{	1,	{ "groupmod",	NULL },		groupmod	},
-	{	2,	{ "group",	"mod" },	groupmod	},
-	{	1,	{ "groupdel",	NULL },		groupdel	},
-	{	2,	{ "group",	"del" },	groupdel	},
-#ifdef EXTENSIONS
-	{	1,	{ "groupinfo",	NULL },		groupinfo	},
-	{	2,	{ "group",	"info" },	groupinfo	},
-#endif
-	{	0	}
+	{	1,	{ "smb_useradd",	NULL },		useradd		},
 };
 
 extern char	*__progname;
Index: user.c
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/user/user.c,v
retrieving revision 1.20.4.8
diff -u -r1.20.4.8 user.c
--- user.c	2001/02/26 18:01:17	1.20.4.8
+++ user.c	2002/10/15 20:39:27
@@ -105,7 +105,7 @@
 	F_USERNAME	= 0x0800
 };
 
-#define CONFFILE	"/etc/usermgmt.conf"
+#define CONFFILE	"/usr/local/adm/smb_useradd.conf"
 
 #ifndef DEF_GROUP
 #define DEF_GROUP	"users"
@@ -619,7 +619,8 @@
 	char	*cp;
 
 	for (cp = login ; *cp ; cp++) {
-		if (!isalnum(*cp) && *cp != '.' && *cp != '_' && *cp != '-') {
+		if (!isalnum(*cp) && *cp != '.' && *cp != '_' && *cp != '-' &&
+		    *cp != '$') {
 			return 0;
 		}
 	}

--tKW2IUtsqtDRztdT--