NetBSD Problem Report #23922

Received: (qmail 10265 invoked by uid 605); 29 Dec 2003 04:36:54 -0000
Message-Id: <200312290436.hBT4amRF008240@edge.back-street.net>
Date: Mon, 29 Dec 2003 13:36:48 +0900 (JST)
From: taca@back-street.net
Sender: gnats-bugs-owner@NetBSD.org
Reply-To: taca@back-street.net
To: gnats-bugs@gnats.NetBSD.org
Subject: useradd(8) isn't useful to add machine account for Samba
X-Send-Pr-Version: 3.95

>Number:         23922
>Category:       bin
>Synopsis:       useradd(8) isn't useful to add machine account for Samba
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    agc
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 29 04:37:00 +0000 2003
>Closed-Date:    Wed Jan 14 09:37:38 +0000 2004
>Last-Modified:  Wed Jan 14 09:37:38 +0000 2004
>Originator:     Takahiro Kambe
>Release:        NetBSD 1.6ZG
>Organization:
Takahiro Kambe
>Environment:


System: NetBSD edge.back-street.net 1.6ZG NetBSD 1.6ZG (CF-R1) #69: Wed Dec 24 19:19:43 JST 2003 taca@edge.back-street.net:/var/obj/sys/arch/i386/compile/CF-R1 i386
Architecture: i386
Machine: i386
>Description:
	useradd(8) can't add a machine account for Samba.  A machine
	account's login name is end with "$" and it is used for adding
	a machine to Windows domain provided by Samba.
>How-To-Repeat:
	Try:

	# useradd 'client1$'
>Fix:
	Make useradd(8) allow '$' as valid login name or add an option
	to relax login name checking.
>Release-Note:
>Audit-Trail:

From: "Greg A. Woods" <woods@weird.com>
To: taca@back-street.net
Cc: NetBSD GNATS submissions and followups <gnats-bugs@gnats.netbsd.org>,
  NetBSD Bugs and PR posting List <netbsd-bugs@NetBSD.ORG>
Subject: Re: bin/23922: useradd(8) isn't useful to add machine account for Samba
Date: Mon, 29 Dec 2003 17:57:50 -0500 (EST)

 [ On Monday, December 29, 2003 at 13:36:48 (+0900), taca@back-street.net wrote: ]
 > Subject: bin/23922: useradd(8) isn't useful to add machine account for Samba
 >
 > 	useradd(8) can't add a machine account for Samba.  A machine
 > 	account's login name is end with "$" and it is used for adding
 > 	a machine to Windows domain provided by Samba.

 That's unfortunate.

 > >Fix:
 > 	Make useradd(8) allow '$' as valid login name or add an option
 > 	to relax login name checking.

 While a trailing '$' is maybe not the worst thing in the world for a
 shell token, and most shells may leave it alone, generally it's not a
 very good idea to try to include a '$' in anything that might end up as
 a shell token in a script or on the command line (e.g. in a username or
 filename).

 I think it's very wise of useradd(8) to disallow usernames with '$'
 characters in them.

 At most it might be OK to add an option to useradd(8) that would allow
 the addition of a username with a trailing dollar sign.

 Better though would be to fix Samba.  A trailing underscore or hyphen or
 some similar non-special character would be much safer for computer
 accounts.

 -- 
 						Greg A. Woods

 +1 416 218-0098                  VE3TCP            RoboHack <woods@robohack.ca>
 Planix, Inc. <woods@planix.com>          Secrets of the Weird <woods@weird.com>

From: Michal Pasternak <michal@pasternak.w.lub.pl>
To: taca@back-street.net
Cc: gnats-bugs@gnats.NetBSD.org
Subject: Re: bin/23922: useradd(8) isn't useful to add machine account for Samba
Date: Mon, 29 Dec 2003 23:05:25 +0100

 taca@back-street.net [Mon, Dec 29, 2003 at 01:36:48PM +0900]:
 > >How-To-Repeat:
 > 	Try:
 > 
 > 	# useradd 'client1$'

 What's the problem with adding "client1_" and changing it via vipw then?

From: Tomasz Luchowski <tomasz@luchowski.com>
To: NetBSD GNATS submissions and followups <gnats-bugs@gnats.netbsd.org>,
  NetBSD Bugs and PR posting List <netbsd-bugs@NetBSD.ORG>
Cc:  
Subject: Re: bin/23922: useradd(8) isn't useful to add machine account for Samba
Date: Tue, 30 Dec 2003 00:34:48 +0100

 On Mon, Dec 29, 2003 at 05:57:50PM -0500, Greg A. Woods wrote:
 > [ On Monday, December 29, 2003 at 13:36:48 (+0900), taca@back-street.net wrote: ]
 > > Subject: bin/23922: useradd(8) isn't useful to add machine account for Samba
 > >
 > > 	useradd(8) can't add a machine account for Samba.  A machine
 > > 	account's login name is end with "$" and it is used for adding
 > > 	a machine to Windows domain provided by Samba.

 Just a random data point - we already are doing something about this:

 zuntum@dell:/usr/pkg/etc/samba# ls
 .pkgsrc   adduser*  deluser*  private/  smb.conf
 zuntum@dell:/usr/pkg/etc/samba# head -6 adduser
 #!/bin/sh
 #
 # $NetBSD: adduser.sh,v 1.1 2003/09/14 22:25:26 jlam Exp $
 #
 # This is an adduser script for NetBSD systems whose useradd(8) doesn't
 # accept "$" in the username.

 -- 
 /* Tomasz Luchowski <tomasz@luchowski.com> */

From: Takahiro Kambe <taca@back-street.net>
To: michal@pasternak.w.lub.pl
Cc: gnats-bugs@gnats.NetBSD.org
Subject: Re: bin/23922: useradd(8) isn't useful to add machine account for
 Samba
Date: Tue, 30 Dec 2003 10:19:22 +0900 (JST)

 In message <20031229220525.GB78917@pasternak.w.lub.pl>
 	on Mon, 29 Dec 2003 23:05:25 +0100,
 	Michal Pasternak <michal@pasternak.w.lub.pl> wrote:
 > taca@back-street.net [Mon, Dec 29, 2003 at 01:36:48PM +0900]:
 > > >How-To-Repeat:
 > > 	Try:
 > > 
 > > 	# useradd 'client1$'
 > 
 > What's the problem with adding "client1_" and changing it via vipw then?
 Since it needs interactive processing, it isn't usable for
 non-interactive processing like testsuite.

 -- 
 Takahiro Kambe <taca@back-street.net>

From: Takahiro Kambe <taca@back-street.net>
To: gnats-bugs@gnats.netbsd.org, netbsd-bugs@NetBSD.ORG, woods@weird.com
Cc:  
Subject: Re: bin/23922: useradd(8) isn't useful to add machine account for
 Samba
Date: Tue, 30 Dec 2003 10:24:28 +0900 (JST)

 In message <m1Ab6Kc-0003NhC@proven.weird.com>
 	on Mon, 29 Dec 2003 17:57:50 -0500 (EST),
 	"Greg A. Woods" <woods@weird.com> wrote:
 > At most it might be OK to add an option to useradd(8) that would allow
 > the addition of a username with a trailing dollar sign.
 Yes, I think this is better solution.

 > Better though would be to fix Samba.  A trailing underscore or hyphen or
 > some similar non-special character would be much safer for computer
 > accounts.
 I don't know the exact reason that Samba use trailing '$' for computer
 account but I guess Samba select explicitly special chracter to
 avoid name collision.  And I don't think it's easy to change Samba's
 specification.

 -- 
 Takahiro Kambe <taca@back-street.net>

From: Takahiro Kambe <taca@back-street.net>
To: tomasz@luchowski.com
Cc: gnats-bugs@gnats.netbsd.org, netbsd-bugs@NetBSD.ORG
Subject: Re: bin/23922: useradd(8) isn't useful to add machine account for
 Samba
Date: Tue, 30 Dec 2003 10:27:55 +0900 (JST)

 In message <20031229233448.GA25610@zunix.luchowski.com>
 	on Tue, 30 Dec 2003 00:34:48 +0100,
 	Tomasz Luchowski <tomasz@luchowski.com> wrote:
 > > > 	useradd(8) can't add a machine account for Samba.  A machine
 > > > 	account's login name is end with "$" and it is used for adding
 > > > 	a machine to Windows domain provided by Samba.
 > 
 > Just a random data point - we already are doing something about this:
 > 
 > zuntum@dell:/usr/pkg/etc/samba# ls
 > .pkgsrc   adduser*  deluser*  private/  smb.conf
 Wow, I don't notice it because I've tried to run testsuite of samba
 3.0.1 from Samba I18N project (in Japan).

 Thanks for your notification.

 -- 
 Takahiro Kambe <taca@back-street.net>

From: Daniel Carosone <dan@geek.com.au>
To: Takahiro Kambe <taca@back-street.net>
Cc: gnats-bugs@gnats.netbsd.org, netbsd-bugs@NetBSD.ORG, woods@weird.com
Subject: Re: bin/23922: useradd(8) isn't useful to add machine account for Samba
Date: Tue, 30 Dec 2003 12:33:22 +1100

 On Tue, Dec 30, 2003 at 10:24:28AM +0900, Takahiro Kambe wrote:
 > I don't know the exact reason that Samba use trailing '$' for computer
 > account but I guess Samba select explicitly special chracter to
 > avoid name collision.  And I don't think it's easy to change Samba's
 > specification.

 I don't recall off-hand, but this may even come directly from the
 SMB/NMB spec.  Various trailing characters are used there to
 distinguish types of names, such as computers, users,
 domains/workgroups, etc. in browse lists.

 It's probably a samba-specific view of the same principle.

 --
 Dan.

From: "Greg A. Woods" <woods@weird.com>
To: Daniel Carosone <dan@geek.com.au>
Cc: Takahiro Kambe <taca@back-street.net>,
  NetBSD GNATS submissions and followups <gnats-bugs@gnats.netbsd.org>,
  NetBSD Bugs and PR posting List <netbsd-bugs@NetBSD.ORG>
Subject: Re: bin/23922: useradd(8) isn't useful to add machine account for Samba
Date: Tue, 30 Dec 2003 02:41:57 -0500 (EST)

 [ On Tuesday, December 30, 2003 at 12:33:22 (+1100), Daniel Carosone wrote: ]
 > Subject: Re: bin/23922: useradd(8) isn't useful to add machine account for Samba
 >
 > I don't recall off-hand, but this may even come directly from the
 > SMB/NMB spec.  Various trailing characters are used there to
 > distinguish types of names, such as computers, users,
 > domains/workgroups, etc. in browse lists.

 If that's true then that's one of the places where Samba should have
 introduced a suitable translation algorithm to make it more friendly and
 compatible with Unix conventions.

 -- 
 						Greg A. Woods

 +1 416 218-0098                  VE3TCP            RoboHack <woods@robohack.ca>
 Planix, Inc. <woods@planix.com>          Secrets of the Weird <woods@weird.com>

From: Daniel Carosone <dan@geek.com.au>
To: NetBSD GNATS submissions and followups <gnats-bugs@gnats.netbsd.org>,
  NetBSD Bugs and PR posting List <netbsd-bugs@NetBSD.ORG>
Cc: Daniel Carosone <dan@geek.com.au>, Takahiro Kambe <taca@back-street.net>
Subject: Re: bin/23922: useradd(8) isn't useful to add machine account for Samba
Date: Tue, 30 Dec 2003 18:49:17 +1100

 On Tue, Dec 30, 2003 at 02:41:57AM -0500, Greg A. Woods wrote:
 > If that's true then that's one of the places where Samba should have
 > introduced a suitable translation algorithm to make it more friendly and
 > compatible with Unix conventions.

 Heh, I think they did - the characters used by windows aren't normally
 printable.

 --
 Dan.

From: andrej misovic <ado@nirvanaclub.sk>
To: gnats-bugs@gnats.NetBSD.org
Cc:  
Subject: [Fwd: Re: bin/23922: useradd(8) isn't useful to add machine account
 for Samba]
Date: Tue, 30 Dec 2003 13:06:34 +0100

 if you want to add machine account on samba,
 add it without $ and then use vipw for
 adding $ for that account...

 		ado

 taca@back-street.net wrote:
 >>Number:         23922
 >>Category:       bin
 >>Synopsis:       useradd(8) isn't useful to add machine account for Samba
 >>Confidential:   no
 >>Severity:       serious
 >>Priority:       medium
 >>Responsible:    bin-bug-people
 >>State:          open
 >>Class:          change-request
 >>Submitter-Id:   net
 >>Arrival-Date:   Mon Dec 29 04:37:00 UTC 2003
 >>Closed-Date:
 >>Last-Modified:
 >>Originator:     Takahiro Kambe
 >>Release:        NetBSD 1.6ZG
 >>Organization:
 > 
 > Takahiro Kambe
 > 
 >>Environment:
 > 
 > 	
 > 	
 > System: NetBSD edge.back-street.net 1.6ZG NetBSD 1.6ZG (CF-R1) #69: Wed Dec 24 19:19:43 JST 2003 taca@edge.back-street.net:/var/obj/sys/arch/i386/compile/CF-R1 i386
 > Architecture: i386
 > Machine: i386
 > 
 >>Description:
 > 
 > 	useradd(8) can't add a machine account for Samba.  A machine
 > 	account's login name is end with "$" and it is used for adding
 > 	a machine to Windows domain provided by Samba.
 > 
 >>How-To-Repeat:
 > 
 > 	Try:
 > 
 > 	# useradd 'client1$'
 > 
 >>Fix:
 > 
 > 	Make useradd(8) allow '$' as valid login name or add an option
 > 	to relax login name checking.
 > 
 >>Release-Note:
 >>Audit-Trail:
 >>Unformatted:
 > 
 >  	
 >  	

 -- 



    >>  jabber: ado@njs.netlab.cz   <<
    >>  e-mail: ado@nirvanaclub.sk  <<
 ----------------------------------------
 // just visit> http://www.nirvanaclub.sk



 -- 



    >>  jabber: ado@njs.netlab.cz   <<
    >>  e-mail: ado@nirvanaclub.sk  <<
 ----------------------------------------
 // just visit> http://www.nirvanaclub.sk


From: "Alistair G. Crooks" <agc@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:  
Subject: pr/23922 CVS commit: src/usr.sbin/user
Date: Wed, 14 Jan 2004 09:35:33 +0000 (UTC)

 Module Name:	src
 Committed By:	agc
 Date:		Wed Jan 14 09:35:33 UTC 2004

 Modified Files:
 	src/usr.sbin/user: user.8 user.c useradd.8 userdel.8 usermod.8

 Log Message:
 Add -S argument to useradd, usermod and userdel, which allows the use of
 a trailing '$' character in user names.

 Requested in PR 23922 by Takahiro Kambe.

 Also, fix a bug in the previous fix to usermod.


 To generate a diff of this commit:
 cvs rdiff -r1.16 -r1.17 src/usr.sbin/user/user.8
 cvs rdiff -r1.74 -r1.75 src/usr.sbin/user/user.c
 cvs rdiff -r1.27 -r1.28 src/usr.sbin/user/useradd.8
 cvs rdiff -r1.24 -r1.25 src/usr.sbin/user/userdel.8
 cvs rdiff -r1.18 -r1.19 src/usr.sbin/user/usermod.8

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed 
State-Changed-By: agc 
State-Changed-When: Wed Jan 14 09:36:29 UTC 2004 
State-Changed-Why:  
The ability to manipulate samba login names (with a trailing '$') 
has been added to user(8), if the -S switch is given to the requisite 
utility. 


Responsible-Changed-From-To: bin-bug-people->agc 
Responsible-Changed-By: agc 
Responsible-Changed-When: Wed Jan 14 09:36:29 UTC 2004 
Responsible-Changed-Why:  
agc took responsibility for this one 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.