Subject: Re: useradd is useless for creating system users
To: Hubert Feyrer <hubert@feyrer.de>
From: Thomas Klausner <wiz@danbala.ifoer.tuwien.ac.at>
List: tech-userlevel
Date: 12/07/2000 18:25:35
Mutt made me believe that Hubert Feyrer wrote:
> On Thu, 7 Dec 2000, Johnny C. Lam wrote:
> > Maybe it's just me, but useradd seems pretty useless for creating
> > system users.  For instance, how do I create a user like "daemon"?
> > The command:
> > 
> > 	useradd -c "Another devil" -d / -g daemon -s /sbin/nologin daemon2
> > 
> > will fail because / already exists.  What should I do if I want to
> > create a user but not populate a home directory?
> 
> This is esp. lame if you don't actually tell it to go and create the dir
> (with the -m switch).

I think the correct fix is (modulo whitespace):
Index: user.c
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/user/user.c,v
retrieving revision 1.33
diff -u -r1.33 user.c
--- user.c      2000/11/04 04:31:43     1.33
+++ user.c      2000/12/07 17:25:25
@@ -1277,7 +1277,7 @@
                        break;
                case 'd':
                        memsave(&u.u_home, optarg, strlen(optarg));
-                       u.u_flags |= (F_MKDIR | F_HOMEDIR);
+                       u.u_flags |= F_HOMEDIR;
                        break;
                case 'e':
                        defaultfield = 1;

Bye,
 Thomas

-- 
Thomas Klausner - wiz@danbala.tuwien.ac.at
A man may be very industrious, and yet not spend his time well. There is no
more fatal blunderer than he who consumes the greater part of life getting
his living. -- Henry David Thoreau