[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1534: adduser problems with home directories

Package: adduser
Version: 1.94-1

Firstly, it doesn't honour the --home option except when creating
`system' users.  This is clearly silly.  If I say
  adduser --home /u2/fred fred
then I want fred's home directory to be /u2/fred.

Secondly, it doesn't set the setgid bit on home directories that it
creates (when usergroups is enabled - clearly when it's disabled it
shouldn't do it).

Thirdly, I notice it makes many system calls without checking the
error returns.

Below is a patch that solves the first two problems.  I have not
bothered to produce a patch for the manpage (which says that the
--home option only works with --system).  Fixing the third problem
will be quite a lot of work.


--- adduser	Tue Oct  3 03:23:52 1995
+++ /usr/local/sbin/adduser	Tue Oct  3 13:39:53 1995
@@ -602,7 +602,11 @@
     ## add the new user to the passwd file
     print "Updating password file... " if ($verbose);
-    $home_dir = $config{"home"} . "/" . $new_name;
+    if ($special_home) {
+	$home_dir = $special_home;
+    } else {
+	$home_dir = $config{"home"} . "/" . $new_name;
+    }
@@ -651,6 +655,7 @@
 	mkdir ($home_dir, $dir_mode);
 	chown ($new_uid, $new_gid, $home_dir);
+        chmod ($dir_mode, $home_dir);
 	print "done.\n" if ($verbose);


Reply to: