Subject: behaviour of useradd -m with existing home directory.
To: None <>
From: Simon Burge <>
List: tech-userlevel
Date: 11/03/2000 01:18:33

It's been pointed out to me that my recent change to useradd so that it
runs "chmod -R u+w <newhomedir>" could have bad consequences of there is
an existing home directory.  I had mistakenly thought that the function
that performed the chmod was not called if the home directory already
existed.  This function also copied the contents of /etc/skel and call
chown to change the ownership of the home directory to the new user.

I'm thinking that the behaviour should be something like the following
pseudo code:

	if (home directory already exists)
		if (owner != new owner)
			warn("home dir already exists with different owner")
			warn("home dir already exists")
		copy skel, chown, chmod

Does anyone disagree that this is a better way of doing things?  Should
the first warning be a fatal error instead of a warning?

Can someone with access to a Solaris or other SysV-type box confirm what
the behaviour of useradd is there under these circumstances?

Simon Burge                            <>
NetBSD Sales, Support and Service: